示例#1
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;
 }
示例#2
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;
 }
示例#3
0
文件: Map.php 项目: nickle799/Mapping
 /**
  * addNot
  * @return Method
  * @throws \Exception
  */
 private function addCount()
 {
     $method = new Method();
     $method->setName('count');
     $method->setDescription('Gets the count of an array');
     $method->setReturnType(Method::RETURN_INT);
     $method->setHandler([$this, 'mappableCount']);
     return $method;
 }
示例#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;
 }