示例#1
0
 /**
  * mappableIfThen
  * @param LexiconMethod[] $true
  * @param LexiconMethod[] $false
  * @return ObjectInterface
  * @throws CatchableException
  */
 public function mappableIfThen($true, $false = null)
 {
     if ($this->getModel()->getValue()) {
         $objectInterface = Parameter::parseLexiconParameter($true, true);
     } else {
         $objectInterface = Parameter::parseLexiconParameter($false, true);
     }
     return $objectInterface;
 }
示例#2
0
文件: Map.php 项目: nickle799/Mapping
 /**
  * mappableFilter
  * @param LexiconMethod[] $subParsed
  * @return array
  */
 public function mappableFilter(array $subParsed)
 {
     $outputValue = [];
     foreach ($this->getModel()->getValue() as $key => $value) {
         $output = Parameter::parseLexiconParameter($subParsed, false, Root::createObject($value));
         if ($output instanceof BooleanInterface) {
             /** @var BooleanInterface $output */
             $output = $output->getValue();
         }
         if ($output) {
             $outputValue[] = $value;
         }
     }
     return $outputValue;
 }