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


PHP Arr::in方法代码示例

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


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

示例1: run

 public function run($bRemoveComment = true)
 {
     $sCurrentLine = '';
     $aInstructionList = array();
     foreach (preg_split("/((\r?\n)|(\r\n?))/", $this->sSelectedContent) as $line) {
         if (empty($line) || !Arr::in($this->nonAtom, substr($line, 0, 1))) {
             continue;
         } else {
             if ($bRemoveComment && strpos($line, ';') !== false) {
                 $sCurrentLine .= strstr($line, ';', true);
                 if (empty($sCurrentLine)) {
                     continue;
                 }
             } else {
                 $sCurrentLine .= $line;
             }
         }
         if (substr_count($sCurrentLine, '(') !== substr_count($sCurrentLine, ')')) {
             continue;
         }
         try {
             //                Util::var_dump($this->tokenize(trim($sCurrentLine))); echo '<br /><br />';
             $aResult = $this->parse($this->tokenize(trim($sCurrentLine)));
             $aInstructionList[] = count($aResult) === 1 ? Arr::first($aResult) : $aResult;
         } catch (Exception $e) {
             echo 'Exception for : ' . '<br />';
             Util::var_dump($sCurrentLine);
         }
         $sCurrentLine = '';
     }
     return $aInstructionList;
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:32,代码来源:DmParser.php

示例2: applyLexiconPatchToTestVerb

 protected function applyLexiconPatchToTestVerb(array &$aTestConjugatedVerb)
 {
     $aTenseList = array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'ps1', 'ps2', 'ps3', 'ps4', 'ps5', 'ps6', 's1', 's2', 's3', 's4', 's5', 's6', 'ip2', 'ip4', 'ip5', 'pr', 'pp');
     $sPatchFile = Config::get('path.real.root') . Config::get('path.relative.root_to_app') . Config::get('path.relative.app_to_data') . Config::get('jsreal.lexicon.simple_nlg.patch.' . $this->sLanguage);
     $sJsonPatch = Filesystem::get($sPatchFile);
     $aPatch = Conversion::getArrayFromJson($sJsonPatch);
     foreach ($aPatch as $sUnit => $aInfo) {
         if (isset($aInfo['V'])) {
             foreach ($aInfo['V'] as $sTenseAndPerson => $sConjugatedVerb) {
                 if (Arr::in($aTenseList, $sTenseAndPerson)) {
                     $aTestConjugatedVerb[$sUnit][$sTenseAndPerson] = $sConjugatedVerb;
                 }
             }
         }
     }
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:16,代码来源:JSRealFrService.php

示例3: getGravatarUrl

 /**
  * Generates an Gravatar URL.
  *
  * Size of the image:
  * * The default size is 32px, and it can be anywhere between 1px up to 2048px.
  * * If requested any value above the allowed range, then the maximum is applied.
  * * If requested any value bellow the minimum, then the default is applied.
  *
  * Default image:
  * * It can be an URL to an image.
  * * Or one of built in options that Gravatar has. See Email::getGravatarBuiltInImages().
  * * If none is defined then a built in default is used. See Email::getGravatarBuiltInDefaultImage().
  *
  * @param string $email
  * @param int    $size
  * @param string $defaultImage
  * @return null|string
  * @link http://en.gravatar.com/site/implement/images/
  */
 public static function getGravatarUrl($email, $size = 32, $defaultImage = 'identicon')
 {
     if (empty($email) || self::_isValid($email) === false) {
         return null;
     }
     $hash = md5(strtolower(trim($email)));
     $parts = array('scheme' => 'http', 'host' => 'www.gravatar.com');
     if (Url::isHttps()) {
         $parts = array('scheme' => 'https', 'host' => 'secure.gravatar.com');
     }
     // Get size
     $size = Vars::limit(Filter::int($size), 32, 2048);
     // Prepare default images
     $defaultImage = trim($defaultImage);
     if (preg_match('/^(http|https)./', $defaultImage)) {
         $defaultImage = urldecode($defaultImage);
     } else {
         $defaultImage = strtolower($defaultImage);
         if (!Arr::in((string) $defaultImage, self::getGravatarBuiltInImages())) {
             $defaultImage = self::getGravatarBuiltInDefaultImage();
         }
     }
     // Build full url
     $parts['path'] = '/avatar/' . $hash . '/';
     $parts['query'] = array('s' => $size, 'd' => $defaultImage);
     $url = Url::create($parts);
     return $url;
 }
开发者ID:jbzoo,项目名称:utils,代码行数:47,代码来源:Email.php

示例4: getLexicon

 public function getLexicon($aAllowedCategoryList = null)
 {
     $aFormatedRule = array();
     foreach ($this->aRawRuleList as $aRawRule) {
         $sUnit = $aRawRule[0];
         $sTableId = $aRawRule[1];
         $sCategory = $this->oDmConverter->getProperName($aRawRule[2]);
         //            if(!isset($aFormatedRule[$sUnit]))
         //            {
         //                // Additional Information
         //                $aFormatedRule[$sUnit] = array();
         //                for($i = 2, $iLength = count($aRawRule); $i < $iLength; $i++)
         //                {
         //                    $aFormatedRule[$sUnit][$this->oDmConverter->getClassName($aRawRule[$i])]
         //                            = $this->oDmConverter->getProperName($aRawRule[$i]);
         //                }
         //
         //                if($aAllowedCategoryList !== null
         //                        && !Arr::in($aAllowedCategoryList,
         //                                $aFormatedRule[$sUnit][Config::get('jsreal.feature.category.alias')]))
         //                {
         //                    unset($aFormatedRule[$sUnit]);
         //                }
         //                else
         //                {
         //                    $aFormatedRule[$sUnit]['tab'][] = $sTableId;
         //                }
         //            }
         //            if($aAllowedCategoryList !== null)
         //            {
         //                Util::var_dump($sCategory);die;
         //            }
         if ($aAllowedCategoryList === null || Arr::in($aAllowedCategoryList, $sCategory)) {
             // Additional Information
             if (!isset($aFormatedRule[$sUnit])) {
                 $aFormatedRule[$sUnit] = array();
             }
             for ($i = 2, $iLength = count($aRawRule); $i < $iLength; $i++) {
                 if (!isset($aFormatedRule[$sUnit][$this->oDmConverter->getClassName($aRawRule[$i])])) {
                     $aFormatedRule[$sUnit][$this->oDmConverter->getClassName($aRawRule[$i])] = $this->oDmConverter->getProperName($aRawRule[$i]);
                 }
             }
             $aFormatedRule[$sUnit]['tab'][] = $sTableId;
         }
     }
     return $aFormatedRule;
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:47,代码来源:DmFormatter.php

示例5: getTestDeclension

 protected function getTestDeclension(array &$aLexicon)
 {
     $aAllowedCategoryList = array('N', 'A');
     //        $aAllowedTypeList = array('N', 'A', 'D');
     $aAllowedDeclensionList = array('fs', 'fp', 'p', 'co', 'su');
     $aOutput = array();
     foreach ($aLexicon as $sUnit => $aCategoryList) {
         foreach ($aCategoryList as $sCategory => $aUnitInfo) {
             if (!empty($aUnitInfo) && Arr::in($aAllowedCategoryList, $sCategory)) {
                 //                    $aOutput[$sUnit][$sCategory]['c'] = $sCategory;
                 foreach ($aUnitInfo as $sDeclensionName => $sDeclension) {
                     if (Arr::in($aAllowedDeclensionList, $sDeclensionName)) {
                         if (($sDeclensionName === 's' || $sDeclensionName === 'p') && isset($aUnitInfo['g'])) {
                             $sDeclensionName = $aUnitInfo['g'] . $sDeclensionName;
                         }
                         $aOutput[$sUnit][$sCategory][$sDeclensionName] = $sDeclension;
                     }
                 }
                 //                    if(Arr::size($aOutput[$sUnit]) <= 1)
                 //                    {
                 //                        unset($aOutput[$sUnit]);
                 //                    }
             }
         }
     }
     return $aOutput;
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:27,代码来源:JSRealService.php


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