Applied fixes from StyleCI

This commit is contained in:
Dominik Liebler
2015-12-21 07:28:20 -05:00
committed by StyleCI Bot
parent 3663603b80
commit fe1f144ec3
167 changed files with 510 additions and 517 deletions

View File

@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
* An example of a Visitor: Group
* An example of a Visitor: Group.
*/
class Group extends Role
{
@@ -25,6 +25,6 @@ class Group extends Role
*/
public function getName()
{
return "Group: " . $this->name;
return 'Group: '.$this->name;
}
}

View File

@@ -3,12 +3,12 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
* class Role
* class Role.
*/
abstract class Role
{
/**
* This method handles a double dispatch based on the short name of the Visitor
* This method handles a double dispatch based on the short name of the Visitor.
*
* Feel free to override it if your object must call another visiting behavior
*
@@ -21,10 +21,10 @@ abstract class Role
// this trick to simulate double-dispatch based on type-hinting
$klass = get_called_class();
preg_match('#([^\\\\]+)$#', $klass, $extract);
$visitingMethod = 'visit' . $extract[1];
$visitingMethod = 'visit'.$extract[1];
// this ensures strong typing with visitor interface, not some visitor objects
if (!method_exists(__NAMESPACE__ . '\RoleVisitorInterface', $visitingMethod)) {
if (!method_exists(__NAMESPACE__.'\RoleVisitorInterface', $visitingMethod)) {
throw new \InvalidArgumentException("The visitor you provide cannot visit a $klass instance");
}

View File

@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
* Visitor Pattern
* Visitor Pattern.
*
* An implementation of a concrete Visitor
*/
@@ -14,7 +14,7 @@ class RolePrintVisitor implements RoleVisitorInterface
*/
public function visitGroup(Group $role)
{
echo "Role: " . $role->getName();
echo 'Role: '.$role->getName();
}
/**
@@ -22,6 +22,6 @@ class RolePrintVisitor implements RoleVisitorInterface
*/
public function visitUser(User $role)
{
echo "Role: " . $role->getName();
echo 'Role: '.$role->getName();
}
}

View File

@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
* Visitor Pattern
* Visitor Pattern.
*
* The contract for the visitor.
*
@@ -16,14 +16,14 @@ namespace DesignPatterns\Behavioral\Visitor;
interface RoleVisitorInterface
{
/**
* Visit a User object
* Visit a User object.
*
* @param \DesignPatterns\Behavioral\Visitor\User $role
*/
public function visitUser(User $role);
/**
* Visit a Group object
* Visit a Group object.
*
* @param \DesignPatterns\Behavioral\Visitor\Group $role
*/

View File

@@ -5,11 +5,10 @@ namespace DesignPatterns\Tests\Visitor\Tests;
use DesignPatterns\Behavioral\Visitor;
/**
* VisitorTest tests the visitor pattern
* VisitorTest tests the visitor pattern.
*/
class VisitorTest extends \PHPUnit_Framework_TestCase
{
protected $visitor;
protected function setUp()
@@ -20,8 +19,8 @@ class VisitorTest extends \PHPUnit_Framework_TestCase
public function getRole()
{
return array(
array(new Visitor\User("Dominik"), 'Role: User Dominik'),
array(new Visitor\Group("Administrators"), 'Role: Group: Administrators')
array(new Visitor\User('Dominik'), 'Role: User Dominik'),
array(new Visitor\Group('Administrators'), 'Role: Group: Administrators'),
);
}

View File

@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
* Visitor Pattern
* Visitor Pattern.
*
* One example for a visitee. Each visitee has to extends Role
*/
@@ -27,6 +27,6 @@ class User extends Role
*/
public function getName()
{
return "User " . $this->name;
return 'User '.$this->name;
}
}