Skip to content

Commit

Permalink
Refactoring With Contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
vluzrmos committed May 9, 2015
1 parent bad9ec7 commit 3700207
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/Vluzrmos/Socketio/Broadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Vluzrmos\Socketio;
use Illuminate\Contracts\Redis\Database as Redis;

class Broadcast {
class Broadcast implements Contracts\Broadcast{

/**
* @var \Redis;
Expand All @@ -18,10 +18,11 @@ public function __construct(Redis $redis){
}

/**
* @param $channel
* @param $event
* @param $message
* @return int
* Publish a message to a channel
* @param String $channel Channel name
* @param String $event Event name
* @param String|Array|Serializable $message the message
* @return mixed
*/
public function publish($channel, $event, $message){
return $this->redis->publish($channel, json_encode([
Expand Down
15 changes: 15 additions & 0 deletions src/Vluzrmos/Socketio/Contracts/Broadcast.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Vluzrmos\Socketio\Contracts;

interface Broadcast{

/**
* Publish a message to a channel
* @param String $channel Channel name
* @param String $event Event name
* @param String|Array|Serializable $message the message
* @return mixed
*/
public function publish($channel, $event, $message);
}
2 changes: 1 addition & 1 deletion src/Vluzrmos/Socketio/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if(!function_exists('publish')){

/**
* Publish something to a channel
* Publish a message to a channel
* @param String $channel Channel name
* @param String $event Event name
* @param String|Array|Serializable $message the message
Expand Down

0 comments on commit 3700207

Please sign in to comment.