當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FilterIterator::current方法代碼示例

本文整理匯總了PHP中FilterIterator::current方法的典型用法代碼示例。如果您正苦於以下問題:PHP FilterIterator::current方法的具體用法?PHP FilterIterator::current怎麽用?PHP FilterIterator::current使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FilterIterator的用法示例。


在下文中一共展示了FilterIterator::current方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: current

 function current()
 {
     $xml = parent::current();
     if (isset($xml[0])) {
         $tasks = array();
         $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), parent::key());
         $task = str_replace(' ', '/', ucwords($task));
         $task = str_replace('/', '_', $task);
         $task = '\\Pyrus\\Task\\' . $task;
         foreach ($xml as $info) {
             $attribs = array();
             if (isset($xml['attribs'])) {
                 $attribs = $xml['attribs'];
             }
             $tasks[] = new $task($this->_parent, $this->_installphase, $info, $attribs, $this->lastversion);
         }
         $attribs = isset($this->_inner['attribs']) ? array($this->_inner['attribs']) : $this->_inner;
         // use proxy for multiple tasks
         return new \Pyrus\Task\MultipleProxy($this->_parent, $tasks, $attribs, $this->key());
     }
     $attribs = array();
     if (isset($xml['attribs'])) {
         $attribs = $xml['attribs'];
     }
     $task = \Pyrus\Task\Common::getTask(parent::key());
     if ($task === false) {
         throw new \RuntimeException('Unknown task `' . parent::key() . '` specified.');
     }
     return new $task($this->_parent, $this->_installphase, $xml, $attribs, $this->lastversion);
 }
開發者ID:peopleplan,項目名稱:Pyrus,代碼行數:30,代碼來源:TaskIterator.php

示例2: accept

 /**
  * {@inheritdoc}
  */
 public function accept()
 {
     if ($this->status === NULL) {
         return TRUE;
     }
     return $this->status == parent::current()->getStatus();
 }
開發者ID:iPublikuj,項目名稱:widgets,代碼行數:10,代碼來源:StatusFilter.php

示例3: accept

 public function accept()
 {
     $currentLine = parent::current();
     if (substr($currentLine, 0, 15) === self::BEGIN_SAMPLE_MARKER) {
         $this->isSampleText = true;
         return false;
     }
     if (substr($currentLine, 0, 13) === self::END_SAMPLE_MARKER) {
         $this->isSampleText = false;
         return false;
     }
     if ($this->isSampleText) {
         return true;
     }
     if ($this->addAllSectionMarkers) {
         if ($this->lineIsSectionMarker($currentLine)) {
             $this->previousLineWasSectionMarker = true;
             return true;
         }
         if ($this->previousLineWasSectionMarker) {
             $this->previousLineWasSectionMarker = false;
             return true;
         }
     }
     return false;
 }
開發者ID:matthiasnoback,項目名稱:leanpub-sampler,代碼行數:26,代碼來源:SampleTextLines.php

示例4: accept

 /**
  * {@inheritdoc}
  */
 public function accept()
 {
     if (null === $this->status) {
         return true;
     }
     return $this->status == parent::current()->getStatus();
 }
開發者ID:amirkheirabadi,項目名稱:pagekit,代碼行數:10,代碼來源:StatusFilter.php

示例5: current

    function current()
    {
        $xml = parent::current();
        if (isset($xml[0])) {
            $tasks = array();
            $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), parent::key());
            $task = str_replace(' ', '/', ucwords($task));
            $task = str_replace('/', '_', $task);
            $task = '\PEAR2\Pyrus\Task\\' . $task;
            foreach ($xml as $info) {
                $attribs = array();
                if (isset($xml['attribs'])) {
                    $attribs = $xml['attribs'];
                }

                $tasks[] = new $task($this->_parent, $this->_installphase, $info, $attribs, $this->lastversion);
            }

            $attribs = isset($this->_inner['attribs']) ? array($this->_inner['attribs']) : $this->_inner;
            // use proxy for multiple tasks
            return new \PEAR2\Pyrus\Task\MultipleProxy($this->_parent, $tasks, $attribs, $this->key());
        }

        $attribs = array();
        if (isset($xml['attribs'])) {
            $attribs = $xml['attribs'];
        }

        $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), parent::key());
        $task = str_replace(' ', '/', ucwords($task));
        $task = str_replace('/', '_', $task);
        $task = '\PEAR2\Pyrus\Task\\' . $task;
        return new $task($this->_parent, $this->_installphase, $xml, $attribs, $this->lastversion);
    }
開發者ID:naderman,項目名稱:PEAR2_Pyrus,代碼行數:34,代碼來源:TaskIterator.php

示例6: accept

 public function accept()
 {
     $return = true;
     if ($this->_filter['filterField'] && $this->_filter['filterCompare']) {
         $filterValue = $this->_filter['filterValue'];
         switch ($this->_filter['filterField']) {
             case 'price':
                 $value = parent::current()->getPrice();
                 break;
             case 'code':
                 $value = parent::current()->getCode();
                 break;
             case 'name':
                 $value = parent::current()->getName();
                 break;
             default:
                 $value = false;
                 break;
         }
         switch ($this->_filter['filterCompare']) {
             case 'ilike':
                 $return = $value == $filterValue;
                 break;
             case 'bigger':
                 $return = $value > $filterValue;
                 break;
             case 'smaller':
                 $return = $value < $filterValue;
                 break;
         }
     }
     return $return;
 }
開發者ID:dneprix,項目名稱:esky,代碼行數:33,代碼來源:FilterField.php

示例7: current

 public function current()
 {
     $tag = parent::current();
     if ($tag) {
         $tag = substr($tag, 6);
     }
     return $tag;
 }
開發者ID:irs,項目名稱:behat-magento-extension,代碼行數:8,代碼來源:StateNameIterator.php

示例8: accept

 /**
  * accept()
  *
  * accept caller for a filter iterator
  *
  * @return bool
  */
 public function accept()
 {
     foreach ($this->filter as $name => $filter) {
         if (false === $filter->get($name)->filter($this->routeValues[$name], parent::current())) {
             return false;
         }
     }
     return true;
 }
開發者ID:naquadria,項目名稱:routing,代碼行數:16,代碼來源:QueryFilter.php

示例9: accept

 /**
  * Check whether the current element of the iterator is acceptable
  *
  * @link http://php.net/manual/en/filteriterator.accept.php
  * @return bool true if the current element is acceptable, otherwise false.
  */
 public function accept()
 {
     /**
      * @var  \SplFileInfo $current
      */
     $current = parent::current();
     if (!$current->isDir()) {
         return false;
     }
 }
開發者ID:dragonrun1,項目名稱:peol,代碼行數:16,代碼來源:GlobPathIterator.php

示例10: current

 /**
  * {@inheritdoc}
  */
 public function current()
 {
     $item = parent::current();
     unset($item['use_as_label']);
     if (isset($item['type'])) {
         if (isset($this->attributeTypes[$item['type']])) {
             $item['type'] = $this->attributeTypes[$item['type']];
         }
     }
     return $item;
 }
開發者ID:qrz-io,項目名稱:ExcelConnectorBundle,代碼行數:14,代碼來源:AttributeXlsxFileIterator.php

示例11: accept

 /**
  * {@inheritdoc}
  */
 public function accept()
 {
     if (null === $this->active) {
         return true;
     }
     $item = parent::current();
     if (in_array($item->getId(), $this->active)) {
         $item->setAttribute('active', true);
     }
     return true;
 }
開發者ID:amirkheirabadi,項目名稱:pagekit,代碼行數:14,代碼來源:ActiveFilter.php

示例12: current

 function current()
 {
     $file = $this->key();
     $curfile = parent::current();
     if (isset(self::$_installGroup['install'][$file])) {
         // add the install-as attribute for these files
         $curfile['attribs']['install-as'] = self::$_installGroup['install'][$file];
     }
     if ($b = self::$_parent->getBaseInstallDir($file)) {
         $curfile['attribs']['baseinstalldir'] = $b;
     }
     return new FileTag($curfile, '', self::$_parent);
 }
開發者ID:helgi,項目名稱:Pyrus,代碼行數:13,代碼來源:FileInstallationFilter.php

示例13: accept

 /**
  * Match php upgrade scripts
  *
  * @return Boolean
  */
 public function accept()
 {
     $filePath = parent::current()->getPathname();
     $match = true;
     foreach ($this->includePaths as $path) {
         $match &= strpos($filePath, $path) !== false;
     }
     foreach ($this->excludePaths as $path) {
         $match &= !(strpos($filePath, $path) !== false);
     }
     $match &= preg_match('%^[0-9]+_(.*)\\.php$%', basename($filePath));
     return $match;
 }
開發者ID:nterray,項目名稱:ForgeUpgrade,代碼行數:18,代碼來源:BucketFilter.php

示例14: accept

 /**
  * ( excerpt from http://php.net/manual/en/regexiterator.accept.php )
  *
  * Matches (string) RegexIterator::current() (or RegexIterator::key() if
  * the RegexIterator::USE_KEY flag is set) against the regular expression.
  *
  * @return boolean TRUE if a match, FALSE otherwise.
  */
 public function accept()
 {
     $this->key = parent::key();
     $this->current = parent::current();
     $matches = array();
     $useKey = $this->flags & self::USE_KEY;
     $subject = $useKey ? (string) $this->key : (string) $this->current;
     switch ($this->mode) {
         case self::MATCH:
             $ret = preg_match($this->regex, $subject, $matches, $this->pregFlags) > 0;
             break;
         case self::GET_MATCH:
             $this->current = array();
             $ret = preg_match($this->regex, $subject, $this->current, $this->pregFlags) > 0;
             break;
         case self::ALL_MATCHES:
             $this->current = array();
             preg_match_all($this->regex, $subject, $this->current, $this->pregFlags);
             $ret = count($this->current) > 0;
             break;
         case self::SPLIT:
             $this->current = preg_split($this->regex, $subject, null, $this->pregFlags);
             $ret = $this->current && count($this->current) > 1;
             break;
         case self::REPLACE:
             $replace_count = 0;
             $result = preg_replace($this->regex, $this->replacement, $subject, -1, $replace_count);
             if ($result === null || $replace_count == 0) {
                 $ret = false;
                 break;
             }
             if ($useKey) {
                 $this->key = $result;
                 $ret = true;
                 break;
             }
             $this->current = $result;
             $ret = true;
             break;
         default:
             $ret = false;
             break;
     }
     if ($this->flags & self::INVERT_MATCH) {
         return !$ret;
     } else {
         return $ret;
     }
 }
開發者ID:alphaxxl,項目名稱:hhvm,代碼行數:57,代碼來源:RegexIterator.php

示例15: accept

 /** Call the filter callback
  * @return result of filter callback
  */
 public function accept()
 {
     $this->key = parent::key();
     $this->current = parent::current();
     switch ($this->mode) {
         default:
         case self::USE_FALSE:
             return false;
         case self::USE_TRUE:
             return true;
         case self::USE_VALUE:
             return (bool) call_user_func($this->callback, $this->current);
         case self::USE_KEY:
             return (bool) call_user_func($this->callback, $this->key);
         case self::USE_BOTH:
             return (bool) call_user_func($this->callback, $this->key, $this->current);
     }
 }
開發者ID:eugenehiggins,項目名稱:wordpress-intermediate,代碼行數:21,代碼來源:Sns_Callback_Filter_Iterator.php


注:本文中的FilterIterator::current方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。