This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
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
52 changed files
with
2,477 additions
and
3,204 deletions.
There are no files selected for viewing
12 changes: 6 additions & 6 deletions
12
src-typhoon/Eloquent/Typhoon/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 Eloquent\Typhoon\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 Eloquent\Typhoon\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
src-typhoon/Eloquent/Typhoon/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
src-typhoon/Eloquent/Typhoon/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 Eloquent\Typhoon\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.