Esempio n. 1
0
 /**
  * addFilter
  * @return Method
  * @throws \Exception
  */
 private function addFilter()
 {
     $method = new Method();
     $method->setName('filter');
     $method->setDescription('Filters an array down based off of a sub parsable string');
     $method->setReturnType(Method::RETURN_MAP);
     $method->setHandler([$this, 'mappableFilter']);
     $parameter = new Parameter();
     $parameter->setDescription('The sub parsable string.');
     $parameter->setAsParsable(true);
     $parameter->setAllowedType(Method::RETURN_STRING);
     $method->addParameter($parameter);
     return $method;
 }
Esempio n. 2
0
 /**
  * addIfThen
  * @return Method
  * @throws \Exception
  */
 private function addIfThen()
 {
     $method = new Method();
     $method->setName('ifThen');
     $method->setDescription('If true, uses the first parameter, otherwise uses the second parameter');
     $method->setReturnType(Method::RETURN_MIXED);
     $parameter = new Parameter();
     $parameter->setAllowedType(Method::RETURN_MIXED);
     $parameter->setDescription('The true parameter');
     $parameter->setAsParsable(true);
     $method->addParameter($parameter);
     $parameter = new Parameter();
     $parameter->setRequired(false);
     $parameter->setAllowedType(Method::RETURN_MIXED);
     $parameter->setDescription('The false parameter');
     $parameter->setAsParsable(true);
     $method->addParameter($parameter);
     $method->setHandler([$this, 'mappableIfThen']);
     return $method;
 }
Esempio n. 3
0
 /**
  * addRound
  * @return Method
  */
 private function addRound()
 {
     $method = new Method();
     $method->setName('round');
     $method->setDescription('Rounds two numbers');
     $method->setReturnType(Method::RETURN_DOUBLE);
     $parameter = new Parameter();
     $parameter->setRequired(false);
     $parameter->setAllowedType(Method::RETURN_DOUBLE);
     $parameter->setDescription('The Precision to round by');
     $method->addParameter($parameter);
     $method->setHandler([$this, 'mappableRound']);
     return $method;
 }
Esempio n. 4
0
 /**
  * addTrim
  * @return Method
  */
 private function addRightFill()
 {
     $method = new Method();
     $method->setName('rightFill');
     $method->setDescription('This adds characters to the right side of the string');
     $method->setReturnType(Method::RETURN_STRING);
     $parameter = new Parameter();
     $parameter->setAllowedType(Method::RETURN_INT);
     $parameter->setDescription('The length to fill the string to');
     $method->addParameter($parameter);
     $parameter = new Parameter();
     $parameter->setRequired(false);
     $parameter->setAllowedType(Method::RETURN_STRING);
     $parameter->setDescription('The string to fill it with.  Defaults to " "');
     $method->addParameter($parameter);
     $method->setHandler([$this, 'mappableRightFill']);
     return $method;
 }