GetOptionKit\Option::isa PHP Method

isa() public method

Value Type Setters.
public isa ( string $type, mixed $option = null )
$type string the value type, valid values are 'number', 'string', 'file', 'boolean', you can also use your own value type name.
$option mixed option(s) for value type class (optionnal)
    public function isa($type, $option = null)
    {
        // "bool" was kept for backward compatibility
        if ($type === 'bool') {
            $type = 'boolean';
        }
        $this->isa = $type;
        $this->isaOption = $option;
        return $this;
    }

Usage Example

コード例 #1
0
ファイル: OptionTest.php プロジェクト: c9s/getoptionkit
 /**
  * @expectedException Exception
  */
 public function testInvalidTypeClass()
 {
     $opt = new Option('scope');
     $opt->isa('SomethingElse');
     $class = $opt->getTypeClass();
 }