本文整理汇总了PHP中String::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP String::__construct方法的具体用法?PHP String::__construct怎么用?PHP String::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($value, $varname = null)
{
$this->setLimit('6');
$value = strtolower($value);
$this->setRegexpMatch('/^([a-f]|[0-9]){6}$/');
parent::__construct($value, $varname);
}
示例2: __construct
public function __construct($value)
{
parent::__construct(strtoupper($value), 1);
if (!preg_match('/^[A-Z0-9]$/', (string) $value)) {
throw new InvalidFieldException('File Id Modifier "' . $value . '" must be A-Z 0-9.');
}
}
示例3: __construct
public function __construct($value)
{
$value = strtoupper($value);
parent::__construct($value, 3);
if (!in_array($value, $this->validClasses)) {
throw new InvalidFieldException($value . ' is not a valid standard entry class.');
}
}
示例4: __construct
/**
* @param string $value
* @param bool $visible
*/
public function __construct($value, $visible = true)
{
if (false !== strpos($value, ';')) {
throw new \InvalidArgumentException('Keyword should not contain semicolons');
}
parent::__construct($value);
$this->visible = $visible;
}
示例5: __construct
public function __construct($value)
{
foreach ($this->triggers as $trigger) {
if (stristr(strtolower($value), $trigger)) {
$value = strtoupper($value);
}
}
parent::__construct($value, 10);
}
示例6: __construct
/**
* @param $filePath string Name of the conf file (or full path).
* @throws Exception
*/
public function __construct($filePath)
{
$this->inFilePath = $filePath;
$contents = @file_get_contents($this->inFilePath);
if (false === $contents) {
throw new Exception('Cannot read file "' . $this->inFilePath . '".');
}
parent::__construct($contents);
}
示例7: __construct
public function __construct($string)
{
parent::__construct($string);
if ($this->getStringLength() >= 1) {
$this->pass = $string;
} else {
throw new \InvalidArgumentException('Password too short');
}
}
示例8: __construct
public function __construct($label, $flags, $timePrecision = null, $timerFormat = null, $val = null, $filterCriteria = null)
{
$this->timerFormat = $timerFormat;
if (isset($timePrecision)) {
$this->timePrecision = $timePrecision;
} else {
$this->timePrecision = 'seconds';
}
parent::__construct($label, $flags, $val, $filterCriteria);
}
示例9: __construct
public function __construct($string, $returnMode = 'default')
{
if (!extension_loaded('mbstring')) {
$err = "This class required mbstring extension to be loaded.\r\n\t\t\t\nPlease check you php to make sure you have mbstring extension";
e($err);
throw new \RuntimeException($err);
}
parent::__construct($string, $returnMode);
mb_regex_encoding("UTF-8");
mb_internal_encoding("UTF-8");
/**
* @todo if have iconv, also set its' encoding to utf-8
*/
}
示例10: __construct
/**
* function __contruct get the parameters to them in the parent construct
*
* @param string $label
* @param array $options
* @param string $flags
* @param string $val
* @param string $filterCriteria
*/
public function __construct($label = null, $options = array(), $flags = null, $val = null, $filterCriteria = null)
{
$this->options = $options;
parent::__construct($label, $flags, $val, $filterCriteria);
//echo $this->showInput(true);
}
示例11: __construct
public function __construct($value)
{
$value = strtolower($value) == 'check destroyed' ? strtoupper($value) : $value;
parent::__construct($value, 16);
}
示例12: __construct
/**
* @param $value string
* @param $type string the type of the displayable object : class, method, property or string
*/
public function __construct($value, $type)
{
parent::__construct($value);
$this->type = $type;
}
示例13: __construct
/**
* @param string $url
* @param string $contents
* @param string $encoding
**/
public function __construct($url, $contents, $encoding = "utf-8")
{
$this->url = $url;
parent::__construct($contents, $encoding);
}
示例14: __construct
/**
* Sets a character limit and makes sure the value is a valid email address.
* @param string $varname Name of variable
* @param string $value Email address
*/
public function __construct($value = null, $varname = null)
{
$this->setLimit('80');
$this->setRegexpMatch('/^[\\w.%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/i');
parent::__construct($value, $varname);
}
示例15: __construct
/**
* Checks the value to ensure it is a proper url.
* The construct will throw an exception if the string does not pass.
* @param string $varname
* @param string $value
*/
public function __construct($value = null, $varname = null)
{
$this->setRegexpMatch('/^(https?:\\/\\/|\\.\\/|\\/\\/)?\\w([,\\.\\w\\-\\/&;?\\+=~#])+$/i');
parent::__construct($value, $varname);
}