/** * Assign a set of tags to a given binding. * * @param array|string $abstracts * @param array|mixed ...$tags * @return void */ public function tag($abstracts, $tags) {// Assign a set of tags to a given binding. $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); // get the first args foreach ($tags as $tag) {// foreach $tags to $tag if (! isset($this->tags[$tag])) { $this->tags[$tag] = []; }// check it is set, so set it like init it. foreach ((array) $abstracts as $abstract) { $this->tags[$tag][] = $this->normalize($abstract); }// if the abstracts is array, we ge we want insert into the array. } }// the function has two parameter one is tag another is abstracts // so last we set the $this->tags, bay tags and abstracts /** * Resolve all of the bindings for a given tag. * * @param string $tag * @return array */ public function tagged($tag)// like get all the callback binding for a given tag. { $results = [];// set a store by array if (isset($this->tags[$tag])) {// i know why set the tag by tag function foreach ($this->tags[$tag] as $abstract) {// get the abstract $results[] = $this->make($abstract);// this->make the function like function. } } return $results;// return store array }
每天laravel-20160805| Container -8
原创
©著作权归作者所有:来自51CTO博客作者lijingsan1的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
每天laravel-20160815| Container -18
/** *
sed scala -
每天laravel-20160807| Container -10
/** * Alias a type to a different name. * * @param string&n
different function definition