/**
  * @param array $record
  *
  * @return array
  */
 public function __invoke(array $record)
 {
     $entity = $this->findEntity((array) $record[static::RECORD_CONTEXT]);
     if (!$entity instanceof ActiveRecordInterface) {
         return $record;
     }
     $contextData = $entity->toArray();
     $contextData['class'] = get_class($entity);
     $sanitizedData = $this->sanitizer->sanitize($contextData);
     $record[static::RECORD_EXTRA][static::EXTRA] = $sanitizedData;
     return $record;
 }
 /**
  * @param array $record
  *
  * @return array
  */
 public function __invoke(array $record)
 {
     $transfer = $this->findTransfer((array) $record[static::RECORD_CONTEXT]);
     if (!$transfer instanceof TransferInterface) {
         return $record;
     }
     unset($record[static::RECORD_CONTEXT][static::CONTEXT_KEY]);
     $contextData = $this->transferToArray($transfer);
     $contextData['class'] = get_class($transfer);
     $sanitizedData = $this->sanitizer->sanitize($contextData);
     $record[static::RECORD_EXTRA][static::EXTRA] = $sanitizedData;
     return $record;
 }
 /**
  * @param string $body
  *
  * @return array
  */
 protected function prepareBody($body)
 {
     if ($this->isJson($body)) {
         $body = Json::decode($body, true);
     }
     if (is_array($body)) {
         $body = $this->sanitizer->sanitize($body);
     }
     if (is_string($body)) {
         $body = ['transfer-response' => $body];
     }
     $body = $this->prepareValues($body);
     return $body;
 }
Esempio n. 4
0
 /**
  * @return array
  */
 protected function getRequestParams()
 {
     return $this->sanitizer->sanitize($_REQUEST);
 }