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


PHP library\String類代碼示例

本文整理匯總了PHP中zibo\library\String的典型用法代碼示例。如果您正苦於以下問題:PHP String類的具體用法?PHP String怎麽用?PHP String使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: __construct

 /**
  * Constructs a new XML-RPC client view
  * @param zibo\xmlrpc\form\ClientForm $form The form of the client
  * @param zibo\library\xmlrpc\Request $request
  * @param zibo\library\xmlrpc\Response $response
  * @param string $responseString
  * @param float $time Time spent on the request in seconds
  * @return null
  */
 public function __construct(ClientForm $form, Request $request = null, Response $response = null, $responseString = null, $time = null)
 {
     parent::__construct(self::TEMPLATE);
     $this->set('form', $form);
     $this->set('time', $time);
     $this->set('requestString', null);
     $this->set('responseString', null);
     if ($request) {
         $this->set('requestString', String::addLineNumbers(trim($request->getXmlString())));
     }
     if ($responseString && !$response) {
         $this->set('responseString', String::addLineNumbers(trim($responseString)));
     } elseif ($response) {
         $this->set('responseString', String::addLineNumbers(trim($response->getXmlString())));
         $errorCode = $response->getErrorCode();
         if ($errorCode) {
             $this->set('error', $errorCode . ': ' . $response->getErrorMessage());
         } else {
             $parser = new ParameterParser();
             $result = $parser->unparse($response->getValue(), true);
             $this->set('result', $result);
         }
     }
     $this->addStyle(self::STYLE);
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:34,代碼來源:ClientView.php

示例2: addValidator

 /**
  * Adds a custom validator for a specified field
  * @param string $fieldName Name of the field
  * @param zibo\library\validation\validator\Validator $validator The validator for the field
  * @return null
  */
 public function addValidator($fieldName, Validator $validator)
 {
     if (String::isEmpty($fieldName)) {
         throw new ZiboException('Cannot add the validator: provided fieldname is empty');
     }
     $this->validators[$fieldName][] = $validator;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:AbstractDataValidator.php

示例3: setName

 /**
  * Set the name of this field
  * @param string $name
  * @return null
  * @throws zibo\library\database\exception\DatabaseException when the name is empty or not a string
  */
 private function setName($name)
 {
     if (!String::isString($name, String::NOT_EMPTY)) {
         throw new DatabaseException('Provided name is empty');
     }
     $this->name = $name;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:FieldExpression.php

示例4: setName

 /**
  * Set the name of the validator
  * @param string $name
  * @return null
  * @throws zibo\ZiboException when $name is not a string
  * @throws zibo\library\orm\exception\ModelException when $name is empty
  */
 private function setName($name)
 {
     if (String::isEmpty($name)) {
         throw new OrmException('Name is empty');
     }
     $this->name = $name;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:14,代碼來源:FieldValidator.php

示例5: setFieldName

 /**
  * Sets the field name for objects or arrays passed to this decorator
  * @param string $fieldName
  * @return null
  * @throws zibo\ZiboException when the field name is empty or an object
  */
 protected function setFieldName($fieldName)
 {
     if ($fieldName != null && String::isEmpty($fieldName)) {
         throw new ZiboException('Provided field name is empty');
     }
     $this->fieldName = $fieldName;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:ValueDecorator.php

示例6: setAction

 private function setAction($action)
 {
     if (String::isEmpty($action)) {
         $action = Dispatcher::ACTION_ASTERIX;
     }
     $this->action = $action;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:7,代碼來源:Route.php

示例7: setMethodName

 /**
  * Sets the method name for the request
  * @param string $methodName
  * @return null
  * @throws zibo\library\xmlrpc\exception\XmlRpcException when the provided method name is empty
  */
 protected function setMethodName($methodName)
 {
     if (String::isEmpty($methodName)) {
         throw new XmlRpcException('Method name cannot be empty');
     }
     $this->methodName = $methodName;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:Request.php

示例8: processRequest

 /**
  * Process the request, get the field value
  * @return null
  */
 public function processRequest()
 {
     parent::processRequest();
     if ($this->value && !String::looksLikeUrl($this->value)) {
         $this->value = 'http://' . $this->value;
     }
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:11,代碼來源:WebsiteField.php

示例9: register

 /**
  * Register a new thumbnailer into this factory
  * @param string name name of the thumbnailer
  * @param Thumbnailer thumbnailer Thumbnailer instance
  */
 public function register($name, Thumbnailer $thumbnailer)
 {
     if (String::isEmpty($name)) {
         throw new ThumbnailException('Name is empty');
     }
     $this->thumbnailers[$name] = $thumbnailer;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:12,代碼來源:ThumbnailFactory.php

示例10: setExpression

 /**
  * Sets the expression string
  * @param string $expression
  * @return null
  * @throws zibo\ZiboException when the expression is empty or invalid
  */
 private function setExpression($expression)
 {
     if (String::isEmpty($expression)) {
         throw new OrmException('Provided expression is empty');
     }
     $this->expression = $expression;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:ModelExpression.php

示例11: parseTag

 /**
  * Parses the tag
  * @param string $content Content of the tag
  * @param array $parameters Parameters of the tag
  * @return string HTML replacement for the tag
  */
 public function parseTag($content, array $parameters)
 {
     if (!$content || !String::looksLikeUrl($content)) {
         return false;
     }
     $width = null;
     $height = null;
     $alt = null;
     if (array_key_exists(0, $parameters) && strpos($parameters[0], 'x')) {
         // [img=<width>x<height>]url[/img]
         list($width, $height) = explode($parameters[0]);
     } else {
         if (array_key_exists('width', $parameters)) {
             // [img width=<width>]url[/img]
             $width = $parameters['width'];
         } elseif (array_key_exists('w', $parameters)) {
             // [img w=<width>]url[/img]
             $width = $parameters['w'];
         }
         if (array_key_exists('height', $parameters)) {
             // [img height=<height>]url[/img]
             $height = $parameters['height'];
         } elseif (array_key_exists('h', $parameters)) {
             // [img h=<height>]url[/img]
             $height = $parameters['h'];
         }
     }
     if (array_key_exists('alt', $parameters)) {
         $alt = $parameters['alt'];
     }
     return $this->getImageHtml($content, $width, $height, $alt);
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:38,代碼來源:ImageTag.php

示例12: setHost

 /**
  * Sets the host of this connection
  * @param string $host
  * @return null
  * @throws zibo\library\network\exception\ConnectionException when the host is invalid
  */
 protected function setHost($host)
 {
     if (String::isEmpty($host)) {
         throw new ConnectionException('Could not set the host: invalid host provided');
     }
     $this->host = $host;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:Connection.php

示例13: quoteIdentifier

 /**
  * Quotes a database identifier
  * @param string $identifier Identifier to quote
  * @return string Quoted identifier
  * @throws zibo\library\database\exception\DatabaseException when the provided identifier is empty or not a scalar value
  */
 public function quoteIdentifier($identifier)
 {
     if (!String::isString($identifier, String::NOT_EMPTY)) {
         throw new DatabaseException('Provided identifier is empty');
     }
     return $identifier;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:AbstractDriver.php

示例14: setLabel

 /**
  * Sets the label for this field
  * @param string $label Translation key for the name of this field
  * @return null
  */
 public function setLabel($label)
 {
     if ($label !== null && String::isEmpty($label)) {
         throw new OrmException('Provided label is empty');
     }
     $this->label = $label;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:12,代碼來源:ModelField.php

示例15: setName

 /**
  * Sets the name of the namespace
  * @param string $name
  * @return null
  * @throws zibo\ZiboException when the provided name is empty or invalid
  */
 private function setName($name)
 {
     if (String::isEmpty($name)) {
         throw new ZiboException('Provided name is empty');
     }
     $this->name = $name;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:13,代碼來源:ModuleNamespace.php


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