This repository has been archived by the owner on Jul 18, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from reatang/master
封装\Yaf\Register并添加启动过程
- Loading branch information
Showing
5 changed files
with
135 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: reatang | ||
* Date: 18/4/10 | ||
* Time: 下午11:29 | ||
*/ | ||
|
||
namespace App\Services; | ||
|
||
|
||
use Psr\Container\ContainerExceptionInterface; | ||
use Psr\Container\ContainerInterface; | ||
use Psr\Container\NotFoundExceptionInterface; | ||
use Yaf\Registry as YafRegister; | ||
|
||
/** | ||
* Register Container | ||
* | ||
* @package App\Services | ||
*/ | ||
class Register implements ContainerInterface | ||
{ | ||
/** | ||
* set instance | ||
* | ||
* @param $name | ||
* @param $instance | ||
* | ||
* @return $this | ||
*/ | ||
public function set($name, $instance) | ||
{ | ||
YafRegister::set($name, $instance); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* alias name | ||
* | ||
* @param $name | ||
* @param $instance | ||
* | ||
* @return Register | ||
*/ | ||
public function alias($name, $instance) | ||
{ | ||
return $this->set($name, $instance); | ||
} | ||
|
||
/** | ||
* get instance | ||
* | ||
* @param string $name | ||
* | ||
* @return mixed | ||
*/ | ||
public function get($name) | ||
{ | ||
return YafRegister::get($name); | ||
} | ||
|
||
/** | ||
* instance isset | ||
* | ||
* @param string $name | ||
* | ||
* @return bool | ||
*/ | ||
public function has($name) | ||
{ | ||
return YafRegister::has($name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters