Логирование запроса

@param $type
@param $source
164715
public static function log($type, $source): void
    {
        if (
            (!($source instanceof \stdClass) && $type === self::TYPE_EXCEPTION) ||
            (!($source instanceof JsonRpcRequest) && \in_array($type, [self::TYPE_REQUEST, self::TYPE_RESPONSE], true))
        ) {
            return;
        }

        /** @var JsonRpcRequest $jsonRpcRequest */
        $jsonRpcRequest = app('JsonRpcRequest');
        $hideIndices = !empty($jsonRpcRequest->controller->hideDataLog) ? $jsonRpcRequest->controller->hideDataLog : false;
        $method = !empty($jsonRpcRequest->method) ? $jsonRpcRequest->method : 'Unknown';

        switch ($type) {
            case self::TYPE_REQUEST:
                $logLevel = 'info';
                $message = 'Request';
                $context = !empty($source->call) ? (array)$source->call : [];
                break;

            case self::TYPE_RESPONSE:
                $logLevel = 'info';
                $message = sprintf('Successful request to method "%s" (id-%s) with params: ', $source->method, $source->id);
                $context = !empty($source->call) ? (array)$source->call : [];
                break;

            case self::TYPE_EXCEPTION:
                $logLevel = 'error';
                $message = sprintf('JsonRpcException %d: %s',
                    isset($source->code) ? $source->code : 0,
                    !empty($source->message) ? $source->message : '');
                $context = !empty($jsonRpcRequest->call) ? (array)$jsonRpcRequest->call : [];
                break;

            default:
                $logLevel = 'info';
                $message = 'No log type specified';
                $context['params'] = [];
                break;
        }

        $hideDataRules = !empty($hideIndices[$type][$method])
            ? $hideIndices[$type][$method]
            : false;

        $hideData = function (&$item, $key, $rules) {
            if (\in_array($key, $rules, true)) {
                $item = '****';
            }
        };

        if ($hideDataRules && !empty($context['params'])) {
            array_walk($context['params'], $hideData, $hideDataRules);
        }

        Log::channel(config('jsonrpc.log_channel'))
            ->$logLevel($message, $context);

    }
695007
public function mergeSource(SourceInterface $source): void
    {
        if (array_key_exists($source->sourceId(), $this->sources)) {
            unset($this->sources[$source->sourceId()]);
        } else {
            $this->newSources[$source->sourceId()] = $source;
        }
        $this->sources[$source->sourceId()] = $source;
    }
129681
public function canExtract($source, $type, ExtractionContextInterface $extractionContext)
    {
        if (!$source instanceof ReflectionClass) {
            return false;
        }

        if (!$type instanceof Schema) {
            return false;
        }

        return !is_null($this->factory->getMetadataForClass($source->getName()));
    }
501765
public function set_source($source) {
        $filerecord = new stdClass;
        $filerecord->source = $source;
        $this->update($filerecord);
    }
300532
public function addType(Type $type, $name = '')
    {
        if (!$name) {
            $name = (string)$type;
        }

        $this->types[$name] = $type;
    }
1353378
public function canConvertFrom($source, $targetType)
    {
        return (preg_match(self::PATTERN_MATCH_SESSIONIDENTIFIER, $source) === 1) && ($targetType === $this->targetType);
    }
648202
protected function validateResource($resource, $type): void
    {
        if (!$resource->isValid()) {
            return;
        }

        $idError = $this->getErrorIdentifier($resource->getRealData(), $type);
        $data = $resource->getData();

        if ($data instanceof FormInterface) {
            if (!$data->isSubmitted()) {
                $data->submit([]);
            }
        } else {
            $errors = $this->validator->validate($data);
            $resource->getErrors()->addAll($errors);
        }

        if (null !== $idError) {
            $resource->getErrors()->add(new ConstraintViolation($idError, $idError, [], $resource->getRealData(), null, null));
        }
    }
1035575
public function sync(AType $type)
    {
        $type_name = $type->getName();

        //Не предопределенных ссылок пока нет

        //[[[
        DB::beginTransaction();

        if($type->getRank() === TypeRank::BLOCK)
        {
            $model = Fbform::where('name', '=', $type_name)->first();
            if(!$model)
            {
                $initializer = $this->initMediator->getAInitializer($type->getFamily());
                $blockRef = $initializer->init($type);
            }
            else
            {
                $this->syncEntity($type, 0);
                //$this->syncRefs($type, $item->id);
            }
        }
        elseif($type->getRank() === TypeRank::GROUP)
        {

            $suffix_pos = strripos($type_name, '_');

            if($suffix_pos)
            {
                $suffix = substr($type_name, $suffix_pos+1);

                if($suffix === 'mail')
                {
                    $collection = Fbmail::where('name', '=', $type_name)->get();
                }
                elseif($suffix === 'mailto')
                {
                    $collection = Fbmailto::where('name', '=', $type_name)->get();
                }
                else
                {
                    throw new FeedbackException('Синхронизатор feedback не обрабатывает тип '.$type_name.'!');
                }
            }
            elseif($type_name === 'mailfromac')
            {
                $collection = Fbac::all();
            }
            else
            {
                throw new FeedbackException('Синхронизатор feedback не обрабатывает тип '.$type_name.'!');
            }

            foreach($collection as $item)
            {
                $this->syncEntity($type, $item->id);
                //$this->syncRefs($type, $item->id);
            }
        }

        DB::commit();
        //]]]
    }
787086
protected function setInvoiceSource($source)
    {
        parent::setInvoiceSource($source);
        switch ($this->invoiceSource->getType()) {
            case Source::Order:
                $this->order = $this->invoiceSource->getSource();
                $this->creditNote = null;
                break;
            case Source::CreditNote:
                $this->creditNote = $this->invoiceSource->getSource();
                $this->order = $this->creditNote->getOrder();
                break;
        }
        $this->shopInvoices = $this->order->getInvoiceCollection();
        $this->shopInvoice = count($this->shopInvoices) > 0 ? $this->shopInvoices->getFirstItem() : null;
    }
1026807
public function canExtract($source, $type, ExtractionContextInterface $extractionContext)
    {
        if (!$source instanceof Route) {
            return false;
        }

        if (!$type instanceof Operation) {
            return false;
        }

        return true;
    }
1339594
public function setSource($source)
    {
        if (Format::isIdentifier($source)) {
            $this->source = $source;
        } else {
            $msg = "'${source}' is not a valid QTI identifier.";
            throw new InvalidArgumentException($msg);
        }
    }
102825
public function addHeader($header, $type = -1){
		if($header instanceof Header)
			$this->other_headers[] = $header;
		else
			$this->addAndCreateHeader($header, $type);
	}
886702
private static function from($type, $key, $default, &$source = null) {

    	if(null === $source) {

	    	if(static :: isMethod($type)) {

	    		$source = [];
	    		static :: parseRawHttpRequest($source);
	    	}
    	}

    	static :: $method = ['method' => $type, 'data' => &$source];

    	if(null !== $key) {
    		return static :: get($key, $default);
    	}

    	return $source;
    }
208947
public function setIcon($source, $type = self::ICON_ASSET) {
		$this->iconType   = (string) $type;
		$this->iconSource = (string) $source;
		
		return $this;
	}
162674
public function create($type, SourceDataFactoryInterface $dataFactory, $name)
    {
        if (is_string($type)) {
            $type = $this->typeRegistry->getType($type);
        }

        return new Source($type, $dataFactory, $name);
    }
105008
public function setSource($source): void
    {
        if (!$source instanceof Db\Query\Select) {
            throw new Grid\GridException('Source of `SelectSource` should be `Db\\Query\\Select` object');
        }
        parent::setSource($source);
    }
53140
public function publishTypeAndFields($typeId, $sourceStatus, $targetStatus)
    {
        try {
            return $this->innerGateway->publishTypeAndFields($typeId, $sourceStatus, $targetStatus);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }