• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AbstractAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AbstractAdapter的典型用法代码示例。如果您正苦于以下问题:PHP AbstractAdapter类的具体用法?PHP AbstractAdapter怎么用?PHP AbstractAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AbstractAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: hasValidCharacters

 /**
  * Checks for allowed characters
  * @see Zend\Validator\Barcode.AbstractAdapter::checkChars()
  */
 public function hasValidCharacters($value)
 {
     if (strpbrk($value, 'ABCD')) {
         $first = $value[0];
         if (!strpbrk($first, 'ABCD')) {
             // Missing start char
             return false;
         }
         $last = substr($value, -1, 1);
         if (!strpbrk($last, 'ABCD')) {
             // Missing stop char
             return false;
         }
         $value = substr($value, 1, -1);
     } elseif (strpbrk($value, 'TN*E')) {
         $first = $value[0];
         if (!strpbrk($first, 'TN*E')) {
             // Missing start char
             return false;
         }
         $last = substr($value, -1, 1);
         if (!strpbrk($last, 'TN*E')) {
             // Missing stop char
             return false;
         }
         $value = substr($value, 1, -1);
     }
     $chars = $this->getCharacters();
     $this->setCharacters('0123456789-$:/.+');
     $result = parent::hasValidCharacters($value);
     $this->setCharacters($chars);
     return $result;
 }
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:37,代码来源:Codabar.php


示例2: checkChars

    /**
     * Checks for allowed characters
     * @see Zend\Validator\Barcode.AbstractAdapter::checkChars()
     */
    public function checkChars($value)
    {
        $first = $value[0];
        if (strpbrk($value, 'ABCD') !== false) {
            $first = $value[0];
            if (strpbrk($first, 'ABCD') === false) {
                // Missing start char
                return false;
            }

            $last = substr($value, -1, 1);
            if (strpbrk($last, 'ABCD') === false) {
                // Missing stop char
                return false;
            }

            $value = substr($value, 1, -1);
        }

        $chars             = $this->_characters;
        $this->_characters = '0123456789-$:/.+';
        $result            = parent::checkChars($value);
        $this->_characters = $chars;
        return $result;
    }
开发者ID:hhatfield,项目名称:zf2,代码行数:29,代码来源:Codabar.php


示例3: select

 /**
  * @param $element
  *
  * @return Page
  */
 public function select($element)
 {
     $pageClass = $this->getPageClass($element);
     $element = $this->item($element);
     $this->debug("Clicking element {$element} (" . $element->getId() . ")\n");
     $element->click();
     return $this->driver->pageFactoryCreate($pageClass);
 }
开发者ID:nibra,项目名称:joomla-pythagoras,代码行数:13,代码来源:Toolbar.php


示例4: testAuthenticationFails

 public function testAuthenticationFails()
 {
     $email = '[email protected]';
     $password = 12345678;
     $this->auth->expects($this->once())->method('getAdapter')->will($this->returnValue($this->adapter));
     $this->auth->expects($this->once())->method('authenticate')->will($this->returnValue($this->getFailureResult()));
     $result = $this->authenticator->authenticate($email, $password);
     // Ensures identity and credential were actually set on the mock adapter
     $this->assertEquals($email, $this->adapter->getIdentity());
     $this->assertEquals($password, $this->adapter->getCredential());
     $this->assertFalse($result->isValid());
 }
开发者ID:urshofer,项目名称:slim-auth,代码行数:12,代码来源:AuthenticatorTest.php


示例5: doFetch

 /**
  * {@inheritdoc}
  */
 protected function doFetch(array $ids)
 {
     $values = array();
     $now = time();
     foreach ($ids as $id) {
         $file = $this->getFile($id);
         if (!file_exists($file) || !($h = @fopen($file, 'rb'))) {
             continue;
         }
         if ($now >= (int) ($expiresAt = fgets($h))) {
             fclose($h);
             if (isset($expiresAt[0])) {
                 @unlink($file);
             }
         } else {
             $i = rawurldecode(rtrim(fgets($h)));
             $value = stream_get_contents($h);
             fclose($h);
             if ($i === $id) {
                 $values[$id] = parent::unserialize($value);
             }
         }
     }
     return $values;
 }
开发者ID:ayoah,项目名称:symfony,代码行数:28,代码来源:FilesystemAdapter.php


示例6: setDimensions

 /**
  * Set dimensions
  *
  * @param  array  $dimensions
  * @param  string $unit
  *
  * @return void
  */
 public function setDimensions(array $dimensions, $unit = null)
 {
     parent::setDimensions($dimensions, $unit);
     if (null !== $unit && ($unit == 'IN' || $unit == 'CM')) {
         $this->dimensions['UnitOfMeasurement'] = $unit;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:15,代码来源:Ups.php


示例7: __construct

 /**
  * Constructor
  *
  * Instantiate the cache db object
  *
  * @param  string  $db
  * @param  int     $lifetime
  * @param  string  $table
  * @param  boolean $pdo
  * @throws Exception
  * @return Sqlite
  */
 public function __construct($db, $lifetime = 0, $table = 'pop_cache', $pdo = false)
 {
     parent::__construct($lifetime);
     $this->setDb($db);
     $pdoDrivers = class_exists('Pdo', false) ? \PDO::getAvailableDrivers() : [];
     if (!class_exists('Sqlite3', false) && !in_array('sqlite', $pdoDrivers)) {
         throw new Exception('Error: SQLite is not available.');
     } else {
         if ($pdo && !in_array('sqlite', $pdoDrivers)) {
             $pdo = false;
         } else {
             if (!$pdo && !class_exists('Sqlite3', false)) {
                 $pdo = true;
             }
         }
     }
     if ($pdo) {
         $this->sqlite = new \PDO('sqlite:' . $this->db);
         $this->isPdo = true;
     } else {
         $this->sqlite = new \SQLite3($this->db);
     }
     if (null !== $table) {
         $this->setTable($table);
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:38,代码来源:Sqlite.php


示例8: __construct

 /**
  * Constructor
  *
  * Instantiate the APC cache object
  *
  * @param  int $lifetime
  * @throws Exception
  * @return Apc
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (!function_exists('apc_cache_info')) {
         throw new Exception('Error: APC is not available.');
     }
     $this->info = apc_cache_info();
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:17,代码来源:Apc.php


示例9: checkLength

 /**
  * Overrides parent checkLength
  *
  * @param string $value Value
  * @return boolean
  */
 public function checkLength($value)
 {
     if (strlen($value) != 8) {
         $this->setCheck(false);
     } else {
         $this->setCheck(true);
     }
     return parent::checkLength($value);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:15,代码来源:Upce.php


示例10: hasValidLength

 /**
  * Overrides parent checkLength
  *
  * @param string $value Value
  * @return bool
  */
 public function hasValidLength($value)
 {
     if (strlen($value) == 7) {
         $this->useChecksum(false);
     } else {
         $this->useChecksum(true);
     }
     return parent::hasValidLength($value);
 }
开发者ID:idwsdta,项目名称:INIT-frame,代码行数:15,代码来源:Ean8.php


示例11: hasValidChecksum

 /**
  * Validates the checksum
  *
  * @param  string $value The barcode to check the checksum for
  * @return bool
  */
 public function hasValidChecksum($value)
 {
     if (strlen($value) == 8) {
         $this->setChecksum('issn');
     } else {
         $this->setChecksum('gtin');
     }
     return parent::hasValidChecksum($value);
 }
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:15,代码来源:Issn.php


示例12: checksum

 /**
  * Validates the checksum
  *
  * @param  string $value The barcode to check the checksum for
  * @return boolean
  */
 public function checksum($value)
 {
     if (strlen($value) == 8) {
         $this->_checksum = '_issn';
     } else {
         $this->_checksum = '_gtin';
     }
     return parent::checksum($value);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:15,代码来源:Issn.php


示例13: setOption

 /**
  * {@inheritdoc}
  */
 public function setOption($key, $value)
 {
     switch ($key) {
         case 'limit':
             $value = (int) $value;
             $this->limit = $value;
             return true;
     }
     return parent::setOption($key, $value);
 }
开发者ID:jeffery,项目名称:Cache,代码行数:13,代码来源:Memory.php


示例14: __construct

 /**
  * Constructor
  *
  * Instantiate the cache session object
  *
  * @param  int $lifetime
  * @return Session
  */
 public function __construct($lifetime = 0)
 {
     parent::__construct($lifetime);
     if (session_id() == '') {
         session_start();
     }
     if (!isset($_SESSION['_POP_CACHE'])) {
         $_SESSION['_POP_CACHE'] = [];
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:18,代码来源:Session.php


示例15: init

 public static function init(array $params)
 {
     parent::init($params);
     $redis = new \Redis();
     if (array_key_exists('socket', $params)) {
         $redis->connect($params['socket']);
     } else {
         $redis->connect($params['host'], $params['port']);
     }
     $redis->select($params['index']);
     self::$redis = $redis;
 }
开发者ID:ariarijp,项目名称:cassowary,代码行数:12,代码来源:RedisAdapter.php


示例16: __construct

 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Redis
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 6379)
 {
     parent::__construct($lifetime);
     if (!class_exists('Redis', false)) {
         throw new Exception('Error: Redis is not available.');
     }
     $this->redis = new \Redis();
     if (!$this->redis->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcached server.');
     }
     $this->version = $this->redis->info()['redis_version'];
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:23,代码来源:Redis.php


示例17: hasValidCharacters

 /**
  * Allows start and stop tag within checked chars
  *
  * @param  string $value The barcode to check for allowed characters
  * @return boolean
  */
 public function hasValidCharacters($value)
 {
     if ($value[0] == '(') {
         $value = substr($value, 1);
         if ($value[strlen($value) - 1] == ')') {
             $value = substr($value, 0, -1);
         } else {
             return false;
         }
     }
     return parent::hasValidCharacters($value);
 }
开发者ID:ninahuanca,项目名称:zf2,代码行数:18,代码来源:Royalmail.php


示例18: __construct

 /**
  * Constructor
  *
  * Instantiate the memcache cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @throws Exception
  * @return Memcache
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcache', false)) {
         throw new Exception('Error: Memcache is not available.');
     }
     $this->memcache = new \Memcache();
     if (!$this->memcache->connect($host, (int) $port)) {
         throw new Exception('Error: Unable to connect to the memcache server.');
     }
     $this->version = $this->memcache->getVersion();
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:23,代码来源:Memcache.php


示例19: __construct

 /**
  * Constructor
  *
  * Instantiate the memcached cache object
  *
  * @param  int    $lifetime
  * @param  string $host
  * @param  int    $port
  * @param  int    $weight
  * @throws Exception
  * @return Memcached
  */
 public function __construct($lifetime = 0, $host = 'localhost', $port = 11211, $weight = 1)
 {
     parent::__construct($lifetime);
     if (!class_exists('Memcached', false)) {
         throw new Exception('Error: Memcached is not available.');
     }
     $this->memcached = new \Memcached();
     $this->addServer($host, $port, $weight);
     $version = $this->memcached->getVersion();
     if (isset($version[$host . ':' . $port])) {
         $this->version = $version[$host . ':' . $port];
     }
 }
开发者ID:popphp,项目名称:pop-cache,代码行数:25,代码来源:Memcached.php


示例20: getItem

 public function getItem($key, &$success = null, $queue = true)
 {
     //check to see if it's already been cached in the class
     $value = parent::getItem($key, $success, $queue);
     if ($success === true) {
         return $value;
     } else {
         $fileName = $this->getFileName($key);
         if ($queue === true && !file_exists($fileName)) {
             if ($this->isQueueInProgress($fileName) === true) {
                 //anonymous function to test if we should continue to wait
                 $condition = function () use($fileName) {
                     return !file_exists($fileName);
                 };
                 $wait = $this->wait($condition);
                 if ($wait === false) {
                     $this->clearQueue($key);
                     $success = false;
                     return null;
                 } else {
                     $success = true;
                     return $this->readFromFile($fileName);
                 }
             } else {
                 $this->queue($fileName);
                 $success = false;
                 return null;
             }
         } else {
             $ttl = $this->getTtl($key);
             if ($ttl < time() && $this->isReCacheInProgress($fileName) === false) {
                 //set the queue
                 $this->reCache($fileName);
                 $success = false;
                 return null;
             } else {
                 $success = true;
                 $value = $this->readFromFile($fileName);
                 return $value;
             }
         }
     }
 }
开发者ID:zoopcommerce,项目名称:juggernaut,代码行数:43,代码来源:FileSystem.php



注:本文中的AbstractAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AbstractController类代码示例发布时间:2022-05-23
下一篇:
PHP AbstractAction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap