public function __invoke($identityArray)
 {
     lineOut(__METHOD__);
     lineOut($identityArray);
     $identityArray = removeEmptyStringAndNullKeyAndValues($identityArray);
     lineOut("after useless removed");
     lineOut($identityArray);
     $this->outPorts['out']->send($identityArray);
     $this->outPorts['out']->disconnect();
 }
Beispiel #2
0
 /**
  * [ ] removeEmptyStringAndNullKeys
  * [ ] removeEmptyStringAndNullValues
  *
  * @param  array  &$array
  * @return array
  */
 public static function removeEmptyStringAndNullKeyAndValues(&$array = array())
 {
     // one piece, remove empties
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             $array[$key] = removeEmptyStringAndNullKeyAndValues($value);
         }
         if ("" === $key || null === $key) {
             unset($array[$key]);
         }
         if ("" === $value || null === $value) {
             unset($array[$key]);
         }
     }
     return $array;
 }