33 lines
608 B
PHP
33 lines
608 B
PHP
<?php
|
|
namespace PSC\Library\Calc\Option;
|
|
|
|
use PSC\Library\Calc\Option\Parser\Input;
|
|
use PSC\Library\Calc\Option\Parser\Select;
|
|
|
|
class Parser
|
|
{
|
|
protected $node;
|
|
|
|
public function parse(\SimpleXMLElement $node)
|
|
{
|
|
$this->node = $node;
|
|
|
|
$obj = false;
|
|
|
|
switch(strtolower((string)$node['type'])) {
|
|
case 'input':
|
|
$obj = new Input();
|
|
break;
|
|
case 'select':
|
|
$obj = new Select();
|
|
break;
|
|
}
|
|
|
|
if($obj) {
|
|
$obj = $obj->parse($node);
|
|
}
|
|
|
|
return $obj;
|
|
|
|
}
|
|
} |