This repository has been archived by the owner on May 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
2,534 additions
and
3,321 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
lib-typhoon/Icecave/Collections/TypeCheck/AbstractValidator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
<?php | ||
namespace Icecave\Collections\TypeCheck; | ||
|
||
|
||
abstract class AbstractValidator | ||
{ | ||
public function __construct() | ||
{ | ||
($this->reflector = (new \ReflectionObject($this))); | ||
$this->reflector = new \ReflectionObject($this); | ||
} | ||
|
||
public function __call($name, array $arguments) | ||
{ | ||
($validatorMethodName = \sprintf('validate%s', \ucfirst(\ltrim($name, '_')))); | ||
if ((!$this->reflector->hasMethod($validatorMethodName))) | ||
{ | ||
throw (new \BadMethodCallException(\sprintf('Call to undefined method %s::%s().', __CLASS__, $name))); | ||
$validatorMethodName = \sprintf('validate%s', \ucfirst(\ltrim($name, '_'))); | ||
if (!$this->reflector->hasMethod($validatorMethodName)) { | ||
throw new \BadMethodCallException(\sprintf('Call to undefined method %s::%s().', __CLASS__, $name)); | ||
} | ||
return $this->reflector->getMethod($validatorMethodName)->invokeArgs($this, $arguments); | ||
} | ||
|
||
private $reflector; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?php | ||
namespace Icecave\Collections\TypeCheck; | ||
|
||
|
||
class DummyValidator extends AbstractValidator | ||
{ | ||
public function __call($name, array $arguments) | ||
{ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
lib-typhoon/Icecave/Collections/TypeCheck/Exception/UnexpectedArgumentException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib-typhoon/Icecave/Collections/TypeCheck/Exception/UnexpectedInputException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?php | ||
namespace Icecave\Collections\TypeCheck\Exception; | ||
|
||
|
||
abstract class UnexpectedInputException extends \InvalidArgumentException | ||
{ | ||
public function __construct($message, \Exception $previous = null) | ||
{ | ||
parent::__construct($message, 0, $previous); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.