当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractAdapter类代码示例

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


在下文中一共展示了AbstractAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = 'user@example.com';
     $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


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