デイリーlaravel-20160813|

Jun 23, 2016 pm 01:05 PM

   /**    * Get the contextual concrete binding for the given abstract.    *    * @param  string  $abstract    * @return string|null    */   protected function getContextualConcrete($abstract)   {       if (isset($this->contextual[end($this->buildStack)][$abstract])) {           return $this->contextual[end($this->buildStack)][$abstract];       }   }//has it then return it,// this array is too complex   /**    * Normalize the given class name by removing leading slashes.    *    * @param  mixed  $service    * @return mixed    */   protected function normalize($service)   {       return is_string($service) ? ltrim($service, '\\') : $service;// back the normal string like namespace   }// Normalize the given class name by removing leading slashes   /**    * Get the extender callbacks for a given type.    *    * @param  string  $abstract    * @return array    */   protected function getExtenders($abstract)   {       if (isset($this->extenders[$abstract])) {// has then return           return $this->extenders[$abstract];       }       return [];   }// Get the extender callbacks for a given type.   /**    * Instantiate a concrete instance of the given type.    *    * @param  string  $concrete    * @param  array   $parameters    * @return mixed    *    * @throws \Illuminate\Contracts\Container\BindingResolutionException    */// make a concrete instance of the given type live.   public function build($concrete, array $parameters = [])// like to make a floor   {       // If the concrete type is actually a Closure, we will just execute it and       // hand back the results of the functions, which allows functions to be       // used as resolvers for more fine-tuned resolution of these objects.       if ($concrete instanceof Closure) {           return $concrete($this, $parameters);       }// if it a concrete as Closure.       $reflector = new ReflectionClass($concrete);// else throw the concrete function to get the class name       // If the type is not instantiable, the developer is attempting to resolve       // an abstract type such as an Interface of Abstract Class and there is       // no binding registered for the abstractions so we need to bail out.       if (! $reflector->isInstantiable()) {// if it a abstract class so can not be instance           if (! empty($this->buildStack)) {// if has the buildStack               $previous = implode(', ', $this->buildStack);//implode the buildStack               $message = "Target [$concrete] is not instantiable while building [$previous].";// it is a trace           } else {               $message = "Target [$concrete] is not instantiable.";           }           throw new BindingResolutionException($message);// throw a Exception       }       $this->buildStack[] = $concrete;// add the concrete to the concrete       $constructor = $reflector->getConstructor();// get the Constructor       // If there are no constructors, that means there are no dependencies then       // we can just resolve the instances of the objects right away, without       // resolving any other types or dependencies out of these containers.       if (is_null($constructor)) {           array_pop($this->buildStack);// if no has the array_pop  delete the concrete           return new $concrete;// return new concrete       }       $dependencies = $constructor->getParameters();//get parameters       // Once we have all the constructor's parameters we can create each of the       // dependency instances and then use the reflection instances to make a       // new instance of this class, injecting the created dependencies in.       $parameters = $this->keyParametersByArgument(           $dependencies, $parameters       );// get       $instances = $this->getDependencies(           $dependencies, $parameters       );       array_pop($this->buildStack);       return $reflector->newInstanceArgs($instances);   }// build function is so powerful, can use a instance and a parameters to new a new instance.
ログイン後にコピー


このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Laravelでフラッシュセッションデータを使用します Laravelでフラッシュセッションデータを使用します Mar 12, 2025 pm 05:08 PM

Laravelは、直感的なフラッシュメソッドを使用して、一時的なセッションデータの処理を簡素化します。これは、アプリケーション内に簡単なメッセージ、アラート、または通知を表示するのに最適です。 データは、デフォルトで次の要求のためにのみ持続します。 $リクエスト -

PHPのカール:REST APIでPHPカール拡張機能を使用する方法 PHPのカール:REST APIでPHPカール拡張機能を使用する方法 Mar 14, 2025 am 11:42 AM

PHPクライアントURL(CURL)拡張機能は、開発者にとって強力なツールであり、リモートサーバーやREST APIとのシームレスな対話を可能にします。尊敬されるマルチプロトコルファイル転送ライブラリであるLibcurlを活用することにより、PHP Curlは効率的なexecuを促進します

Laravelテストでの簡略化されたHTTP応答のモッキング Laravelテストでの簡略化されたHTTP応答のモッキング Mar 12, 2025 pm 05:09 PM

Laravelは簡潔なHTTP応答シミュレーション構文を提供し、HTTP相互作用テストを簡素化します。このアプローチは、テストシミュレーションをより直感的にしながら、コード冗長性を大幅に削減します。 基本的な実装は、さまざまな応答タイプのショートカットを提供します。 Illuminate \ support \ facades \ httpを使用します。 http :: fake([[ 'google.com' => 'hello world'、 'github.com' => ['foo' => 'bar']、 'forge.laravel.com' =>

Codecanyonで12の最高のPHPチャットスクリプト Codecanyonで12の最高のPHPチャットスクリプト Mar 13, 2025 pm 12:08 PM

顧客の最も差し迫った問題にリアルタイムでインスタントソリューションを提供したいですか? ライブチャットを使用すると、顧客とのリアルタイムな会話を行い、すぐに問題を解決できます。それはあなたがあなたのカスタムにより速いサービスを提供することを可能にします

PHPにおける後期静的結合の概念を説明します。 PHPにおける後期静的結合の概念を説明します。 Mar 21, 2025 pm 01:33 PM

記事では、PHP 5.3で導入されたPHPの後期静的結合(LSB)について説明し、より柔軟な継承を求める静的メソッドコールのランタイム解像度を可能にします。 LSBの実用的なアプリケーションと潜在的なパフォーマ

フレームワークのカスタマイズ/拡張:カスタム機能を追加する方法。 フレームワークのカスタマイズ/拡張:カスタム機能を追加する方法。 Mar 28, 2025 pm 05:12 PM

この記事では、フレームワークにカスタム機能を追加し、アーキテクチャの理解、拡張ポイントの識別、統合とデバッグのベストプラクティスに焦点を当てています。

フレームワークセキュリティ機能:脆弱性から保護します。 フレームワークセキュリティ機能:脆弱性から保護します。 Mar 28, 2025 pm 05:11 PM

記事では、入力検証、認証、定期的な更新など、脆弱性から保護するためのフレームワークの重要なセキュリティ機能について説明します。

See all articles