本文整理汇总了PHP中static::add方法的典型用法代码示例。如果您正苦于以下问题:PHP static::add方法的具体用法?PHP static::add怎么用?PHP static::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromString
/**
* Parse a query string into a Query object
*
* @param string $query Query string to parse
*
* @return self
*/
public static function fromString($query)
{
$q = new static();
if ($query === '') {
return $q;
}
$foundDuplicates = $foundPhpStyle = false;
foreach (explode('&', $query) as $kvp) {
$parts = explode('=', $kvp, 2);
$key = rawurldecode($parts[0]);
if ($paramIsPhpStyleArray = substr($key, -2) == '[]') {
$foundPhpStyle = true;
$key = substr($key, 0, -2);
}
if (isset($parts[1])) {
$value = rawurldecode(str_replace('+', '%20', $parts[1]));
if (isset($q[$key])) {
$q->add($key, $value);
$foundDuplicates = true;
} elseif ($paramIsPhpStyleArray) {
$q[$key] = array($value);
} else {
$q[$key] = $value;
}
} else {
$q->add($key, null);
}
}
// Use the duplicate aggregator if duplicates were found and not using
// PHP style arrays.
if ($foundDuplicates && !$foundPhpStyle) {
$q->setAggregator(self::duplicateAggregator());
}
return $q;
}
示例2: fromString
/**
* Parse a query string into a QueryString object
*
* @param string $query Query string to parse
*
* @return self
*/
public static function fromString($query)
{
$q = new static();
if (0 !== strlen($query)) {
if ($query[0] == '?') {
$query = substr($query, 1);
}
foreach (explode('&', $query) as $kvp) {
$parts = explode('=', $kvp, 2);
$key = rawurldecode($parts[0]);
$paramIsPhpStyleArray = substr($key, -2) == '[]';
if ($paramIsPhpStyleArray) {
$key = substr($key, 0, -2);
}
if (array_key_exists(1, $parts)) {
$value = rawurldecode(str_replace('+', '%20', $parts[1]));
if ($paramIsPhpStyleArray && !$q->hasKey($key)) {
$value = array($value);
}
$q->add($key, $value);
} else {
$q->add($key, '');
}
}
}
return $q;
}
示例3: request
public static function request()
{
$class = new static();
!Input::has('deleteShippingMethod') ?: $class->delete(Input::get('deleteShippingMethod'));
!Input::has('updateShippingMethod') ?: $class->update(Input::get('updateShippingMethod'))->with(Input::get('shipping.fill'));
!Input::has('addShippingMethod') ?: $class->add()->with(Input::get('shipping.fill'));
}
示例4: nextWorkingDay
private function nextWorkingDay($current)
{
if ($current->format('H') < 19 && !$this->isSunday($current) && !$this->isWeekend($current) && !$this->isHoliday($current)) {
$next = new static($current->format('Y-m-d ' . static::DEFAULT_OFFICE_CLOSE_TIME), $this->timezone);
} else {
$next = new static($current->format('Y-m-d ' . static::DEFAULT_OFFICE_CALL_TIME), $this->timezone);
$i = 0;
// We have 0 future dates to start with
while ($i < 1) {
$next->add(new DateInterval('P1D'));
// Add 1 day
if ($this->isHoliday($next)) {
continue;
}
// Don't include year to ensure the check is year independent
// Note that you may need to do more complicated things for special holidays that don't use specific dates like "the last Friday of this month"
if ($this->isWeekend($next)) {
continue;
}
// These next lines will only execute if continue isn't called for this iteration
$i++;
}
}
return $next;
}
示例5: request
public static function request()
{
$class = new static();
$class->acton = Input::get('action');
!Input::has('deleteSearch') ?: $class->delete(Input::get('deleteSearch'));
$class->action != 'addSearch' ?: $class->add(Input::get('search'), Input::get('users'));
}
示例6: fromFileScan
/**
* @ignore
*/
public static function fromFileScan($uPattern)
{
$tSep = quotemeta(DIRECTORY_SEPARATOR);
$tPos = strrpos($uPattern, $tSep);
if ($tSep !== '/' && $tPos === false) {
$tSep = '/';
$tPos = strrpos($uPattern, $tSep);
}
if ($tPos !== false) {
$tPattern = substr($uPattern, $tPos + strlen($tSep));
$tPath = substr($uPattern, 0, $tPos + strlen($tSep));
} else {
$tPath = $uPattern;
$tPattern = "";
}
$tTemp = new static();
$tHandle = new \DirectoryIterator($tPath);
$tPatExists = strlen($uPattern) > 0;
for (; $tHandle->valid(); $tHandle->next()) {
if (!$tHandle->isFile()) {
continue;
}
$tFile = $tHandle->current();
if ($tPatExists && !fnmatch($tPattern, $tFile)) {
continue;
}
$tTemp->add($tPath . $tFile);
}
return $tTemp;
}
示例7: request
public static function request()
{
$class = new static();
Input::get('action') != 'addComment' ?: $class->add(Input::all());
!Input::has('hideComment') ?: $class->hide(head(Input::get('hideComment', [])));
!Input::has('unhideComment') ?: $class->unhide(head(Input::get('unhideComment', [])));
!Input::has('deleteComment') ?: $class->delete(head(Input::get('deleteComment', [])));
}
示例8: forType
/**
* @param string $type_
*
* @return \Components\Object_Properties
*/
public static function forType($type_)
{
$instance = new static($type_);
foreach (self::arrayForType($type_) as $property) {
$instance->add($property['name'], $property['type'], $property['nameMapped'], $property['typeMapped']);
}
return $instance;
}
示例9: fromArray
/**
* @param array $strings
*
* @return static
*/
public static function fromArray(array $strings)
{
$list = new static();
foreach ($strings as $oneString) {
$list->add($oneString);
}
return $list;
}
示例10: createFailure
/**
* convenience method to create a simple failure report
*
* @param string $message
* @param mixed $errors
* @return common_report_Report
*/
public static function createFailure($message, $errors = array())
{
$report = new static(self::TYPE_ERROR, $message);
foreach ($errors as $error) {
$report->add($error);
}
return $report;
}
示例11: fromConfig
public static function fromConfig($config)
{
$collection = new static();
foreach ($config as $key => $config) {
$collection->add($key, $config);
}
return $collection;
}
示例12: build
/**
* A handy starter for creating a button group with buttons.
* @param array $buttons
* @return ButtonGroup
*/
public static function build(array $buttons = [])
{
$group = new static();
foreach ($buttons as $button) {
$group->add($button);
}
return $group;
}
示例13: getCommandResult
/**
* @param CommandInterface $cmd
* @return ResponseCollection
*/
public function getCommandResult(CommandInterface $cmd)
{
$collection = new static();
foreach (new ResponseFilterIterator($this, $cmd) as $response) {
$collection->add($response);
}
return $collection;
}
示例14: fromXml
/**
* Construct the result based on the given xml.
* @param SimpleXMLElement $xmlElement
* @return \CultuurNet\Search\SuggestionsResult
*/
public static function fromXml(SimpleXMLElement $xmlElement)
{
$result = new static();
foreach ($xmlElement->xpath('//suggestion') as $xmlSuggestion) {
$result->add(SuggestionsItem::fromXml($xmlSuggestion));
}
return $result;
}
示例15: createRandomProducts
public static function createRandomProducts($numberOfProducts = 1)
{
$collection = new static();
for ($i = $numberOfProducts; $i > 0; $i--) {
$collection->add(new Product());
}
return $collection;
}