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


PHP StringHelper::endsWith方法代码示例

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


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

示例1: setPrefix

 /**
  * Prefix to apply to properties loaded using <code>file</code>.
  * A "." is appended to the prefix if not specified.
  * @param string $prefix prefix string
  * @return void
  * @since 2.0
  */
 function setPrefix($prefix)
 {
     $this->prefix = $prefix;
     if (!StringHelper::endsWith(".", $prefix)) {
         $this->prefix .= ".";
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:14,代码来源:XmlPropertyTask.php

示例2: main

 function main($_sourceFileName)
 {
     if ($this->fromPrefix === null || !StringHelper::startsWith($this->fromPrefix, $_sourceFileName) || !StringHelper::endsWith($this->fromPostfix, $_sourceFileName)) {
         return null;
     }
     $varpart = $this->_extractVariablePart($_sourceFileName);
     $substitution = $this->toPrefix . $varpart . $this->toPostfix;
     return array($substitution);
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:9,代码来源:GlobMapper.php

示例3: setName

    /**
     * The name of the file, or the pattern for the name, that
     * should be used for selection.
     *
     * @param pattern the file pattern that any filename must match
     *                against in order to be selected.
     */
    public function setName($pattern) {
        $pattern = str_replace('\\', DIRECTORY_SEPARATOR, $pattern);
        $pattern = str_replace('/', DIRECTORY_SEPARATOR, $pattern);

        if (StringHelper::endsWith(DIRECTORY_SEPARATOR, $pattern)) {
            $pattern .= "**";
        }
        $this->pattern = $pattern;
    }
开发者ID:nationalfield,项目名称:symfony,代码行数:16,代码来源:FilenameSelector.php

示例4: MaskCheck

 public static function MaskCheck($item, $masks)
 {
     $maskCheck = false;
     foreach ($masks as $mask) {
         if (\StringHelper::startsWith($item, $mask) || \StringHelper::endsWith($item, $mask)) {
             $maskCheck = true;
         }
     }
     return $maskCheck;
 }
开发者ID:dotBunny,项目名称:Blueprint,代码行数:10,代码来源:string.php

示例5: templateFileName

 function templateFileName($templateName)
 {
     if ($templateName != null) {
         if (!StringHelper::endsWith($templateName, '.html')) {
             $templateName .= '.html';
         }
         return $templateName;
     }
     $rc = new ReflectionObject($this);
     $filename = $rc->getName() . '.html';
     return $filename;
 }
开发者ID:ademirzanetti,项目名称:labs,代码行数:12,代码来源:TemplateControl.php

示例6: normalizeSlashes

 function normalizeSlashes($path)
 {
     // Url must not end with slash
     while (StringHelper::endsWith($path, '/')) {
         $path = substr($path, 0, -1);
     }
     // Url must start with slash
     if (!StringHelper::startsWith($path, '/')) {
         $path = '/' . $path;
     }
     return $path;
 }
开发者ID:ademirzanetti,项目名称:labs,代码行数:12,代码来源:Route.php

示例7: evaluate

 function evaluate()
 {
     $osName = strtolower(Phing::getProperty("os.name"));
     if ($this->family !== null) {
         if ($this->family === "windows") {
             return StringHelper::startsWith("win", $osName);
         } elseif ($this->family === "mac") {
             return strpos($osName, "mac") !== false || strpos($osName, "darwin") !== false;
         } elseif ($this->family === "unix") {
             return StringHelper::endsWith("ix", $osName) || StringHelper::endsWith("ux", $osName) || StringHelper::endsWith("bsd", $osName) || StringHelper::startsWith("sunos", $osName) || StringHelper::startsWith("darwin", $osName);
         }
         throw new BuildException("Don't know how to detect os family '" . $this->family . "'");
     }
     return false;
 }
开发者ID:vinnivinsachi,项目名称:Vincent-DR,代码行数:15,代码来源:OsCondition.php

示例8: listFilesByType

 /**
  * Return files in a folder by type
  * @param $folderPath
  * @param $type
  * @param $removeExtension
  */
 public static function listFilesByType($folderPath, $type, $removeExtension = false) {
     $results = null;
     if (is_dir($folderPath)) {
         $results = array();
         if ($handle = opendir($folderPath)) {
             while (($file = readdir($handle)) !== false) {
                 if (StringHelper::endsWith($file, $type)) {
                     if ($removeExtension) {
                         $results[] = substr($file, 0, strlen($file) - 4);
                     } else {
                         $results[] = $file;
                     }
                 }
             }
             closedir($handle);
         }
     }
     return $results;
 }
开发者ID:regisdiogo,项目名称:Paprika,代码行数:25,代码来源:FolderHelper.php

示例9: main

 /**
  * do the work
  * @throws BuildException if required attributes are not supplied
  *                        property and attribute are required attributes
  */
 public function main()
 {
     if ($this->property === null) {
         throw new BuildException("property attribute required", $this->getLocation());
     }
     if ($this->file == null) {
         throw new BuildException("file attribute required", $this->getLocation());
     }
     $value = $this->file->getName();
     if ($this->suffix != null && StringHelper::endsWith($this->suffix, $value)) {
         // if the suffix does not starts with a '.' and the
         // char preceding the suffix is a '.', we assume the user
         // wants to remove the '.' as well
         $pos = strlen($value) - strlen($this->suffix) - 1;
         if ($pos > 0 && $this->suffix[0] !== '.' && $value[$pos] === '.') {
             $pos--;
         }
         $value = StringHelper::substring($value, 0, $pos);
     }
     $this->getProject()->setNewProperty($this->property, $value);
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:26,代码来源:Basename.php

示例10: nextQuery

 /**
  * Returns entire SQL source
  *
  * @return string|null
  */
 public function nextQuery()
 {
     $sql = null;
     while (($line = $this->sqlReader->readLine()) !== null) {
         $delimiter = $this->parent->getDelimiter();
         $project = $this->parent->getOwningTarget()->getProject();
         $line = ProjectConfigurator::replaceProperties($project, trim($line), $project->getProperties());
         if ($line != $delimiter && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line))) {
             continue;
         }
         $sql .= " " . $line . "\n";
         /**
          * fix issue with PDO and wrong formated multistatements
          * @issue 1108
          */
         if (StringHelper::endsWith($delimiter, $line)) {
             break;
         }
     }
     return $sql;
 }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:26,代码来源:DummyPDOQuerySplitter.php

示例11: _slashify

 /**
  *
  * Enter description here ...
  * @param  PhingFile|string $path
  * @param  boolean          $isDirectory
  * @return string
  */
 public function _slashify($path, $isDirectory)
 {
     $p = (string) $path;
     if (self::$separator !== '/') {
         $p = str_replace(self::$separator, '/', $p);
     }
     if (!StringHelper::startsWith('/', $p)) {
         $p = '/' . $p;
     }
     if (!StringHelper::endsWith('/', $p) && $isDirectory) {
         $p = $p . '/';
     }
     return $p;
 }
开发者ID:kenguest,项目名称:phing,代码行数:21,代码来源:PhingFile.php

示例12: fromURIPath

 function fromURIPath($p)
 {
     if (StringHelper::endsWith("/", $p) && strlen($p) > 1) {
         // "/foo/" --> "/foo", but "/" --> "/"
         $p = substr($p, 0, strlen($p) - 1);
     }
     return $p;
 }
开发者ID:halfer,项目名称:Meshing,代码行数:8,代码来源:UnixFileSystem.php

示例13: runStatements

 /**
  * read in lines and execute them
  * @param Reader $reader
  * @param null $out
  * @throws BuildException
  */
 public function runStatements(Reader $reader, $out = null)
 {
     $sql = "";
     $line = "";
     $buffer = '';
     if (is_array($this->filterChains) && !empty($this->filterChains)) {
         $in = FileUtils::getChainedReader(new BufferedReader($reader), $this->filterChains, $this->getProject());
         while (-1 !== ($read = $in->read())) {
             // -1 indicates EOF
             $buffer .= $read;
         }
         $lines = explode("\n", $buffer);
     } else {
         $in = new BufferedReader($reader);
         while (($line = $in->readLine()) !== null) {
             $lines[] = $line;
         }
     }
     try {
         foreach ($lines as $line) {
             $line = trim($line);
             $line = ProjectConfigurator::replaceProperties($this->project, $line, $this->project->getProperties());
             if (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) {
                 continue;
             }
             if (strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM ") {
                 continue;
             }
             $sql .= " " . $line;
             $sql = trim($sql);
             // SQL defines "--" as a comment to EOL
             // and in Oracle it may contain a hint
             // so we cannot just remove it, instead we must end it
             if (strpos($line, "--") !== false) {
                 $sql .= "\n";
             }
             if ($this->delimiterType == self::DELIM_NORMAL && StringHelper::endsWith($this->delimiter, $sql) || $this->delimiterType == self::DELIM_ROW && $line == $this->delimiter) {
                 $this->log("SQL: " . $sql, Project::MSG_VERBOSE);
                 $this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter)), $out);
                 $sql = "";
             }
         }
         // Catch any statements not followed by ;
         if ($sql !== "") {
             $this->execSQL($sql, $out);
         }
     } catch (SQLException $e) {
         throw new BuildException("Error running statements", $e);
     }
 }
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:56,代码来源:CreoleSQLExecTask.php

示例14: evalExpression

 /**
  * Evaluates expression and returns resulting value.
  * @return mixed
  */
 protected function evalExpression()
 {
     $this->log("Evaluating PHP expression: " . $this->expression);
     if (!StringHelper::endsWith(';', trim($this->expression))) {
         $this->expression .= ';';
     }
     $retval = null;
     eval('$retval = ' . $this->expression);
     return $retval;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:14,代码来源:PhpEvalTask.php

示例15: throwableMessage

 public static function throwableMessage(&$msg, $error, $verbose)
 {
     while ($error instanceof BuildException) {
         $cause = $error->getCause();
         if ($cause === null) {
             break;
         }
         $msg1 = (string) $error;
         $msg2 = (string) $cause;
         if (StringHelper::endsWith($msg2, $msg1)) {
             $msg .= StringHelper::substring($msg1, 0, strlen($msg1) - strlen($msg2));
             $error = $cause;
         } else {
             break;
         }
     }
     if ($verbose || !$error instanceof BuildException) {
         $msg .= (string) $error;
     } else {
         $msg .= $error->getMessage() . PHP_EOL;
     }
 }
开发者ID:kenguest,项目名称:phing,代码行数:22,代码来源:DefaultLogger.php


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