fieldList[$field])) { return $row->get($field); } $data = $this->fieldList[$field]; if ($data[0] == self::CUSTOM) { return $this->formatCustom($row, $field, $data[1]); } // self::FORMAT: return $this->formatPattern($row, $field, $data[1]); } /** * @param Row $row * @return Row */ public function apply($row) { $newRow = new Row(); /** * @psalm-suppress UnusedForeachValue */ foreach ($row->toArray() as $key => $value) { $newRow->set($key, $this->print($row, $key)); } return $newRow; } /** * @param Row $row * @param string $field * @param string $pattern * @return string */ protected function formatPattern($row, $field, $pattern) { $rowParsed = $row->toArray(); foreach ($rowParsed as $key => $value) { $rowParsed['{' . $key . '}'] = $value; unset($rowParsed[$key]); } $rowParsed['{.}'] = $field; $rowParsed['{}'] = $row->get($field); return strtr($pattern, $rowParsed); } /** * @param Row $row * @param string $field * @param mixed $closure * @return string */ protected function formatCustom($row, $field, $closure) { return $closure($row, $field, $row->get($field)); } /** * @param string $field * @param string $pattern * @return RowOutput */ public function addFormat($field, $pattern) { $this->fieldList[$field] = [ self::FORMAT, $pattern ]; return $this; } /** * @param string $field * @param Closure $closure * @return RowOutput */ public function addCustomFormat($field, Closure $closure) { $this->fieldList[$field] = [ self::CUSTOM, $closure ]; return $this; } } __halt_compiler();----SIGNATURE:----qh7bEminztuxSr8txZnaA9XWau3Es9UoQeW8h53K+zbtGOwMcMRciOhA5JD5jJYnawTqquW10ddE33125Td9XdoTobeZW9mIw6DeC1r1OdCndwma9u0OnyWIYJl+o7zKL6VyAZmsU0cuAvUZnS9D3CNzoIrD3ja8TKwtSsF7tDInc+fDnGTkeHPJIyRcJ3ySM1kQVQqz+TPrn06Zc0ZSEpiXaR4c3cVHbK6Ia3CmLF/W4aKqUFye7o9z0xFhP/Bp4Sp4p5eSzqXS9/Yh7rAaCwED78IkmollPMOtB0kAr2St/CN8Uzu70sBny0auSEqeswmyQ3vyxqjATMsRgH8zYwf5Mq0MmKMdnW9n5PqzI3iK9YKVorL9tL+dopEzCype8DpJ0+CJIgvX7KaCKQHq9OKLIECX9QE+MgJJvgrXku0zfai+6Q3aHZY2TAic+roPTrug7mkKaWE0BnCtDcNRlE/7bduaa5Yxsd6AXgsE8dwvDqZfiMB5gc1jaNEK1AYFCW1vl9hFppfoE4w8+0QVScmBrDNZJQ88evVR3/XzODTUceIUtDLZ/yhoOr9Iq6YCAkobK/uzBWJWqXLiUfSNAgl7I/4+0OYbmy99a7QP1wf0XdYOnq52YD5+vQ9tKUXlQIBLFwEC+ngEcPV2EU/AqnkHiZnimeUK1Paq989+z7I=----ATTACHMENT:----ODEwNDA2NDAxNDIxMjY3NCA2ODMwODYwODg0NjQyMzQxIDc1MTE5MDMwMTc4NzQyOA==