-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
junjun
committed
May 23, 2016
1 parent
3bf37d5
commit 7431756
Showing
3 changed files
with
67 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Krasen | ||
* Date: 16/5/17 | ||
* Time: 16:32 | ||
* Email: [email protected] | ||
*/ | ||
|
||
namespace Purple\Storage; | ||
|
||
|
||
use Purple\Adapter\AdapterInterface; | ||
|
||
abstract class AbstractStorage implements StorageInterface | ||
{ | ||
protected $adapter; | ||
|
||
public function __construct(AdapterInterface $adapter) | ||
{ | ||
$this->adapter = $adapter; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,45 +1,27 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: krasen | ||
* Date: 5/21/2016 | ||
* Time: 2:10 PM | ||
*/ | ||
|
||
namespace Purple\Storage; | ||
|
||
|
||
use Purple\Request\Request; | ||
|
||
class Storage implements StorageInterface | ||
{ | ||
|
||
/** | ||
* 存储数据 | ||
* @param Request $request | ||
* @return mixed | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
// TODO: Implement store() method. | ||
} | ||
|
||
/** | ||
* 获取数据 | ||
* @param $id | ||
* @return mixed | ||
*/ | ||
public function retrieve($id) | ||
{ | ||
// TODO: Implement find() method. | ||
} | ||
|
||
/** | ||
* 清空数据 | ||
* @return mixed | ||
*/ | ||
public function clear() | ||
{ | ||
// TODO: Implement clear() method. | ||
} | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Krasen | ||
* Date: 16/5/17 | ||
* Time: 16:40 | ||
* Email: [email protected] | ||
*/ | ||
|
||
namespace Purple\Storage; | ||
|
||
|
||
use Purple\Request\Request; | ||
|
||
class Storage extends AbstractStorage | ||
{ | ||
|
||
public function retrieve($id) | ||
{ | ||
return $this->adapter->find($id); | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
$this->adapter->store($request); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,35 +1,19 @@ | ||
<?php | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: krasen | ||
* Date: 5/21/2016 | ||
* Time: 2:06 PM | ||
*/ | ||
|
||
namespace Purple\Storage; | ||
|
||
use Purple\Request\Request; | ||
|
||
interface StorageInterface | ||
{ | ||
/** | ||
* 存储数据 | ||
* @param Request $request | ||
* @return mixed | ||
*/ | ||
public function store(Request $request); | ||
|
||
/** | ||
* 获取数据 | ||
* @param $id | ||
* @return mixed | ||
*/ | ||
public function retrieve($id); | ||
|
||
/** | ||
* 清空数据 | ||
* @return mixed | ||
*/ | ||
public function clear(); | ||
<?php | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Krasen | ||
* Date: 16/5/17 | ||
* Time: 16:24 | ||
* Email: [email protected] | ||
*/ | ||
namespace Purple\Storage; | ||
|
||
use Purple\Request\Request; | ||
|
||
interface StorageInterface | ||
{ | ||
public function retrieve($id); | ||
|
||
public function store(Request $request); | ||
} |