失败
@param $message
@param null $data
@return array
334849
public function error($message, $data=null){
        is_object($data) && $data = (array)$data;
        $return = ['success' => false, 'message' => $message, 'data'=>$data];
        return $return;
    }
528034
private function getNestedMessages(Message $message, Schema $schema): array
    {
        $messages = [];

        foreach ($schema->getFields() as $field) {
            if (!$field->getType()->isMessage()) {
                continue;
            }

            if (!$message->has($field->getName())) {
                continue;
            }

            if ($field->isASingleValue()) {
                $messages[] = $message->get($field->getName());
            } else {
                $messages = array_merge($messages, array_values($message->get($field->getName())));
            }
        }

        return $messages;
    }
215991
public function aError($message,$url='',$data=[])
    {
        $url=is_null($url) || $url=='' ? 'javascript:history.back(-1)' : $url;
        if(Request::isAjax() ){
            return $this->json(1,$message,array_merge($data,['url'=>$url]));
        }else{
            return $this->error($message,$url);
        }
    }
604306
protected function getCreated(Message $message) {
    $value = NULL;
    if (isset($message)) {
      $value = $message->getCreatedTime();
    }
    return $value;
  }
868145
protected function response($data, $message = "", $code = 200)
    {
        $message = empty($message) ? [] : compact('message');

        return (request()->ajax() || request()->wantsJson())
            ? new JsonResponse($message + compact('data'), $code)
            : new Response($data, $code);
    }
588933
public function error($message, $data)
    {
        // TODO: Implement error() method.
        $this->logMessages->enqueue([
            'prefix'  => 'error',
            'date'    => date('Y-m-d H:i:s'),
            'message' => $message,
            'data'    => $data
        ]);

        return $this;
    }
1020276
private function getUserMessages(Message $message)
    {
        $currentUser = $this->tokenStorage->getToken()->getUser();

        return $this->om->getRepository(UserMessage::class)->findBy(['message' => $message, 'user' => $currentUser]);
    }
929439
protected function output($code, $message, $data = null)
    {
        $result = [
            'code'    => $code,
            'message' => $message,
            'data'    => $data,
        ];

        if (!$this->assoc) {
            $result = (object) $result;
        }

        return $result;
    }
184916
public function getMessages($item = null)
    {
        if (is_string($item)) {
            return array_key_exists($item, $this->messages) ? $this->messages[$item] : array();
        }

        return $this->messages;
    }
1178950
protected function decodeMessage(Protobuf\Message $message, $data)
    {
        // Get message descriptor
        $descriptor = Protobuf::getRegistry()->getDescriptor($message);

        foreach ($data as $key => $v) {
            // Get the field by tag number or name
            $field = $this->useTagNumber
                   ? $descriptor->getField($key)
                   : $descriptor->getFieldByName($this->toSnakeCase($key));

            // Unknown field found
            if (!$field) {
                $unknown = new Protobuf\Codec\PhpArray\Unknown($key, gettype($v), $v);
                $message->addUnknown($unknown);
                continue;
            }

            if ($field->isRepeated()) {
                // Make sure the value is an array of values
                $v = is_array($v) && is_int(key($v)) ? $v : array($v);
                foreach ($v as $k => $vv) {
                    $v[$k] = $this->filterValue($vv, $field);
                }
            } else {
                $v = $this->filterValue($v, $field);
            }

            $message->_set($field->getNumber(), $v);
        }

        return $message;
    }
65635
public static function makeError($message, array $data = [])
    {
        $res = [
            'success' => false,
            'message' => $message,
        ];

        if (!empty($data)) {
            $res['data'] = $data;
        }

        return $res;
    }
476744
public static function generateResult($pass, $type, $message = '', $data = [])
    {
        $result = [];
        $result['success'] = (bool) $pass;
        $result['type'] = $type;
        if (is_array($message)) {
            $data = $message;
            $message = '';
        }
        $message = $message ?: self::getNotifyMessage($type);
        $result['message'] = Util::vsprintf($message, $data);

        return $result;
    }
79352
private function prepareRequestArguments(array $data = null, string $method = null): array
    {
        $data   = $data ?? [];
        $method = $method ?? 'GET';

        // Removes null entries.
        $data = array_filter($data, function ($val) {
            return (null !== $val);
        });

        $headers = [
            'Content-Type' => 'application/json',
            'X-Auth-Email' => $this->email,
            'X-Auth-Key'   => $this->auth_key,
        ];

        $args = [
            'body'    => wp_json_encode($data),
            'headers' => $headers,
            'method'  => strtoupper($method),
            'timeout' => 15,
        ];

        return $args;
    }
234969
public function info($message, $data)
    {
        $this->logMessages->enqueue([
            'prefix'  => 'info',
            'date'    => date('Y-m-d H:i:s'),
            'message' => $message,
            'data'    => $data
        ]);

        return $this;
    }
1025469
private function tags($message, $data)
    {
        return array_merge(
            array_keys($message->getTo() ?: []),
            array_keys($message->getCc() ?: []),
            array_keys($message->getBcc() ?: []),
            $data['__telescope'] ?? []
        );
    }
241917
public function json($status_code, $message, $data = null)
    {
        return response()->json([
                                    'status_code' => $status_code,
                                    'message'     => $message,
                                    'data'        => $data,
                                    'request'     => \request()->all(),
                                ]);
    }
590689
public function json($code,$message='',$data=[])
    {
        header('Content-type:application/json');
        if(is_array($code)){
            echo json_encode($code);
        }else{
            echo json_encode(['code'=>$code,'message'=>$message,'result'=>$data]);
        }
        exit;
    }