Changeset View
Changeset View
Standalone View
Standalone View
src/applications/fact/chart/PhabricatorChartFunction.php
Show All 37 Lines | final public function setArguments(array $arguments) { | ||||
} | } | ||||
$parser->setHaveAllArguments(true); | $parser->setHaveAllArguments(true); | ||||
$parser->parseArguments(); | $parser->parseArguments(); | ||||
return $this; | return $this; | ||||
} | } | ||||
final public static function newFromDictionary(array $map) { | |||||
PhutilTypeSpec::checkMap( | |||||
$map, | |||||
array( | |||||
'function' => 'string', | |||||
'arguments' => 'list<wild>', | |||||
)); | |||||
$functions = self::getAllFunctions(); | |||||
$function_name = $map['function']; | |||||
if (!isset($functions[$function_name])) { | |||||
throw new Exception( | |||||
pht( | |||||
'Attempting to build function "%s" from dictionary, but that '. | |||||
'function is unknown. Known functions are: %s.', | |||||
$function_name, | |||||
implode(', ', array_keys($functions)))); | |||||
} | |||||
$function = id(clone $functions[$function_name]) | |||||
->setArguments($map['arguments']); | |||||
return $function; | |||||
} | |||||
public function toDictionary() { | public function toDictionary() { | ||||
return $this->getArgumentParser()->getRawArguments(); | return array( | ||||
'function' => $this->getFunctionKey(), | |||||
'arguments' => $this->getArgumentParser()->getRawArguments(), | |||||
); | |||||
} | } | ||||
public function getSubfunctions() { | public function getSubfunctions() { | ||||
$result = array(); | $result = array(); | ||||
$result[] = $this; | $result[] = $this; | ||||
foreach ($this->getFunctionArguments() as $argument) { | foreach ($this->getFunctionArguments() as $argument) { | ||||
foreach ($argument->getSubfunctions() as $subfunction) { | foreach ($argument->getSubfunctions() as $subfunction) { | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |