本文整理汇总了PHP中self::append方法的典型用法代码示例。如果您正苦于以下问题:PHP self::append方法的具体用法?PHP self::append怎么用?PHP self::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::append方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSelectStatement
/**
* Create a Select statement which returns the given array of rows.
*
* @param array $rows
* @return Zend_Test_DbStatement
*/
public static function createSelectStatement(array $rows = array())
{
$stmt = new self();
foreach ($rows as $row) {
$stmt->append($row);
}
return $stmt;
}
示例2: toSubjected
function toSubjected(ISubjectivity $object)
{
$me = new self();
foreach ($this->toArray() as $elt) {
$me->append($elt->toSubjected($object));
}
return $me;
}
示例3: denyFromAll
/**
* Create .htaccess and write 'Deny from all'
*
* @param Event $event Event
*
* @return null
*/
public static function denyFromAll(Event $event)
{
$composer = $event->getComposer();
$vendor = $composer->getConfig()->get("vendor-dir");
$path = $vendor . "/.htaccess";
$htaccess = new self($path);
$htaccess->append("Deny from all");
$composerIo = $event->getIO();
$composerIo->write("File " . $path . " created, HTTP access denied");
}
示例4: load
/**
* Load job
*
* @param string $id
* @return bool|Job
*/
public static function load($id)
{
$client = Kue::$instance->client;
if (!($data = $client->hgetall('q:job:' . $id))) {
return false;
}
$data['data'] = json_decode($data['data'], true);
$job = new self($data['type'], null);
$job->append($data);
return $job;
}
示例5: find
/**
* Find list of nodes with a CSS selector
*
* @param string $selector
* @param int $idx
*
* @return SimpleHtmlDomNode|SimpleHtmlDomNode[]|null
*/
public function find($selector, $idx = null)
{
$elements = new self();
foreach ($this as $node) {
foreach ($node->find($selector) as $res) {
$elements->append($res);
}
}
if (null === $idx) {
return $elements;
} else {
if ($idx < 0) {
$idx = count($elements) + $idx;
}
}
return isset($elements[$idx]) ? $elements[$idx] : null;
}
示例6: loadArray
public static function loadArray($A, &$widgets)
{
if (!$widgets instanceof self) {
return false;
}
uasort($A, array('self', 'arraySort'));
$result = new self();
foreach ($A as $v) {
if ($widgets->{$v['id']} != null) {
$w = clone $widgets->{$v['id']};
# Settings
unset($v['id']);
unset($v['order']);
foreach ($v as $sid => $s) {
$w->{$sid} = $s;
}
$result->append($w);
}
}
return $result;
}
示例7: map
/**
* @param callable $fn ($item, int $i)
* @return ResultSet
*/
public function map($fn)
{
$i = 0;
$resultSet = new self();
foreach ($this as $key => $item) {
$resultSet->append(call_user_func_array($fn, [$item, $i++]));
}
return $resultSet;
}
示例8: pad
public function pad($padchar, $padlen, $type = STR_PAD_LEFT)
{
if (self::$isMbstringLoaded) {
$filllen = $padlen - $this->length();
if ($filllen < 1) {
return $this;
} else {
$padChar = new self($padchar);
if ($type === STR_PAD_LEFT || $type === STR_PAD_RIGHT) {
if (($_len = $padChar->length()) === 1) {
$padChar->repeat($filllen);
} elseif ($_len !== $filllen) {
if ($filllen < $_len) {
$padChar->set($padChar->substring(0, $filllen));
} else {
$padChar->repeat(floor($filllen / $_len));
if (($rem = $filllen % $_len) !== 0) {
$padChar->append($padChar->substring(0, $rem));
}
}
}
if ($type === STR_PAD_LEFT) {
$this->string = $padChar . $this->string;
} else {
$this->string .= $padChar;
}
} elseif ($type === STR_PAD_BOTH) {
$this->pad($padchar, (int) floor($filllen / 2) + $this->length(), STR_PAD_LEFT);
$this->pad($padchar, $padlen, STR_PAD_RIGHT);
} else {
$message = __METHOD__ . "() invalid pad type. Use STR_PAD_LEFT or STR_PAD_RIGHT, STR_PAD_BOTH.";
throw new Sabel_Exception_InvalidArgument($message);
}
}
} else {
$this->string = str_pad($this->string, $padlen, $padchar, $type);
}
return $this;
}
示例9: merge
/**
* Merges this ItemPriceCollection with the given ItemPriceCollection to produce
* a new ItemPriceCollection for ItemPrices that share a key.
*
* The resulting ItemPriceCollection is composed of ItemPrices as constructed by
* the given comparator.
*
* Multiple items sharing the same key from the same collection are subject to
* being merged multiple times in the order in which they appear in the collection.
*
* @param ItemPriceCollection $collection The collection to be merged
* @param ItemComparatorInterface $comparator The comparator used to merge item prices
*/
public function merge(ItemPriceCollection $collection, ItemComparatorInterface $comparator)
{
// Set a new collection for the merged results
$price_collection = new self();
foreach ($collection as $new_item) {
foreach ($this as $current_item) {
// Only items with matching non-null keys may be merged
if ($current_item->key() !== null && $current_item->key() === $new_item->key() && ($item = $comparator->merge($current_item, $new_item))) {
$price_collection->append($item);
}
}
}
return $price_collection;
}
示例10: createFromContent
/**
* Creates a job list by the content of a crontab file
*
* @param string $content
* @return \axy\crontab\JobList
* @throws \axy\crontab\errors\InvalidJobString
*/
public static function createFromContent($content)
{
$list = new self();
foreach (explode("\n", $content) as $line) {
$line = trim($line);
if ($line === '') {
continue;
}
if (substr($line, 0, 1) === '#') {
continue;
}
$list->append($line);
}
return $list;
}
示例11: factory
public static function factory($hours_string) {
$tmp = new self();
$hour_pieces = explode(' ', $hours_string);
foreach($hour_pieces as $piece) {
$tmp->append(self::hours_helper($piece));
}
return $tmp;
}
示例12: createFromTransition
public static function createFromTransition(array $transition, $deduceRecurringRule = TRUE)
{
$date = new DateTime($transition['time'], new DateTimeZone('UTC'));
$transitionRule = new self(array('isdst' => $transition['isdst'], 'offset' => $transition['offset'], 'abbr' => $transition['abbr'], 'from' => clone $date));
if (!$deduceRecurringRule) {
$transitionRule->addTransitionDate($date);
} else {
$transitionRule->append(array('month' => $date->format('n'), 'hour' => $date->format('G'), 'minute' => (int) $date->format('i'), 'second' => (int) $date->format('s'), 'wkday' => (int) $date->format('w'), 'numwk' => self::getNumWk($date)));
}
return $transitionRule;
}
示例13: fromNodeList
/**
* Swaps the current node list out for a given list.
*
* @param DomNodeList $list New list of nodes
* @return DomQuery New instance
*/
public static function fromNodeList(DomNodeList $list)
{
$q = new self();
foreach ($list as $node) {
$q->append($node);
}
return $q;
}
示例14: filter
/**
* @param string|callable $selector css selector or callable
*
* @return Set
*/
public function filter($selector)
{
$newSet = new self(array(), $this->ownerDocument);
if (is_string($selector)) {
foreach ($this as $node) {
/** @var $node Attr|Element|Tag|Field|Text|Cdata|Comment */
if ($node->is($selector)) {
$newSet->append($node);
}
}
} else {
if (is_callable($selector)) {
foreach ($this as $index => $node) {
/** @var $node Attr|Element|Tag|Field|Text|Cdata|Comment */
if ($selector($node, $index)) {
$newSet->append($node);
}
}
} else {
if ($selector instanceof \DOMNode) {
foreach ($this as $node) {
/** @var $node Attr|Element|Tag|Field|Text|Cdata|Comment */
if ($node->isSameNode($selector)) {
$newSet->append($node);
}
}
}
}
}
return $newSet;
}