|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
-
- namespace Kuxin;
-
- /**
- * Class Storage
- *
- * @package Kuxin
- * @author Pakey <pakey@qq.com>
- */
- class Storage
- {
- /**
- * @var array
- */
- protected $config;
-
- /**
- * @var \Kuxin\Storage\File
- */
- protected $handler;
-
- public function __construct(array $config)
- {
- $this->config = $config;
- $class = 'Kuxin\\storage\\' . $config['driver'];
- return $this->handler = Loader::instance($class, [$config['option']]);
- }
-
- /**
- * @param string $file
- * @return bool
- */
- public function exist(string $file)
- {
- return $this->handler->exist($file);
- }
-
- /**
- * @param $file
- * @return bool|int
- */
- public function mtime(string $file)
- {
- return $this->handler->mtime($file);
- }
-
- /**
- * @param string $file
- * @param string $content
- * @return bool|int
- */
- public function write(string $file, string $content)
- {
- return $this->handler->write($file, $content);
- }
-
- /**
- * @param $file
- * @return bool|string
- */
- public function read(string $file)
- {
- return $this->handler->read($file);
- }
-
- /**
- * @param $file
- * @param $content
- * @return bool|int
- */
- public function append(string $file, string $content)
- {
- return $this->handler->append($file, $content);
- }
-
- /**
- * @param $file
- * @return bool
- */
- public function remove(string $file)
- {
- return $this->handler->remove($file);
- }
-
- /**
- * @param $file
- * @return string
- */
- public function getUrl(string $file)
- {
- return $this->handler->getUrl($file);
- }
-
- /**
- * @param $file
- * @return string
- */
- public function getPath(string $file)
- {
- return $this->handler->getPath($file);
- }
-
- /**
- * @return string
- */
- public function error()
- {
- return $this->handler->error();
- }
-
- /**
- * @return string
- */
- public function flush()
- {
- return $this->handler->flush();
- }
- }
|