public function enrich(ModelInformationInterface $information)
    {
        $this->info = $information;

        try {
            foreach ($this->steps as $step) {
                /** @var EnricherStepInterface $instance */
                $instance = app($step);

                $this->info = $instance->setEnricher($this)->enrich($this->info);
            }

        } catch (Exception $e) {

            $key     = null;
            $section = null;
            $message = $e->getMessage();

            if ($e instanceof ModelInformationEnrichmentException) {
                $key     = $e->getKey();
                $section = $e->getSection();
            } elseif ($e instanceof ModelConfigurationDataException) {
                $message .= " ({$e->getDotKey()})";
            }

            // Wrap and decorate exceptions so it is easier to track the problem source
            throw (new ModelInformationEnrichmentException(
                "{$information->modelClass()} model configuration issue: \n{$message}",
                (int) $e->getCode(),
                $e
            ))
                ->setModelClass($information->modelClass())
                ->setSection($section)
                ->setKey($key);
        }

        return $information;
    }
public function enrich(ModelInformationInterface $information)
    {
        $this->info = $information;

        try {
            foreach ($this->steps as $step) {
                /** @var EnricherStepInterface $instance */
                $instance = app($step);

                $this->info = $instance->setEnricher($this)->enrich($this->info);
            }

        } catch (Exception $e) {

            $key     = null;
            $section = null;
            $message = $e->getMessage();

            if ($e instanceof ModelInformationEnrichmentException) {
                $key     = $e->getKey();
                $section = $e->getSection();
            } elseif ($e instanceof ModelConfigurationDataException) {
                $message .= " ({$e->getDotKey()})";
            }

            // Wrap and decorate exceptions so it is easier to track the problem source
            throw (new ModelInformationEnrichmentException(
                "{$information->modelClass()} model configuration issue: \n{$message}",
                (int) $e->getCode(),
                $e
            ))
                ->setModelClass($information->modelClass())
                ->setSection($section)
                ->setKey($key);
        }

        return $information;
    }
public function enrich ( ModelInformationInterface $ information ) { $ this -> info = $ information ; try { foreach ( $ this -> steps as $ step ) { /** @var EnricherStepInterface $instance */ $ instance = app ( $ step ) ; $ this -> info = $ instance -> setEnricher ( $ this ) -> enrich ( $ this -> info ) ; } } catch ( Exception $ e ) { $ key = null ; $ section = null ; $ message = $ e -> getMessage ( ) ; if ( $ e instanceof ModelInformationEnrichmentException ) { $ key = $ e -> getKey ( ) ; $ section = $ e -> getSection ( ) ; } elseif ( $ e instanceof ModelConfigurationDataException ) { $ message .= " ({$e->getDotKey()})" ; } // Wrap and decorate exceptions so it is easier to track the problem source throw ( new ModelInformationEnrichmentException ( "{$information->modelClass()} model configuration issue: \n{$message}" , ( int ) $ e -> getCode ( ) , $ e ) ) -> setModelClass ( $ information -> modelClass ( ) ) -> setSection ( $ section ) -> setKey ( $ key ) ; } return $ information ; }
Enriches a single model's information.

Note that this does not offer contextual information for other models.

@param ModelInformationInterface|ModelInformation $information
@return ModelInformationInterface|ModelInformation
@throws ModelInformationEnrichmentException
Enriches a single model s information .