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


PHP ArrayObject::append方法代码示例

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


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

示例1: testShouldMapThreeInvoices

 public function testShouldMapThreeInvoices()
 {
     $invoices = new \ArrayObject();
     $invoices->append(new \Entities\SampleInvoice('48,00', '905/IT', '2016020508', ''));
     $invoices->append(new \Entities\SampleInvoice('15,00', '', '365/PF', ''));
     $invoices->append(new \Entities\SampleInvoice('85,20', '', '353/PF', ''));
     $invoices->append(new \Entities\SampleInvoice('100', '666/AA', '2015120508', ''));
     $payments = new \ArrayObject();
     $payments->append(new \Entities\Payment('48,00', 'RO1755898361', 'Arve nr. 905/IT', 'Company OÜ'));
     $payments->append(new \Entities\Payment('15,00', 'RO1756686260', 'Tellimus 365/PF', 'Firma AS'));
     $payments->append(new \Entities\Payment('85,20', 'RO1757162444', 'tellimus 353/PF 24,12,15', 'ISA JA POJAD OÜ'));
     $payments->append(new \Entities\Payment('100.80', '2016010700183611-1', 'Arve nr. 8/NE', 'EXPERDID OÜ'));
     $payments->append(new \Entities\Payment('196.99', 'RO1757164672', 'Tellimus', 'AS OÜ'));
     $payments->append(new \Entities\Payment('10.50', '2016020700153611-1', '-', 'kiiredjavihased OÜ'));
     $extractorMock = m::mock('extractor');
     $extractorMock->shouldReceive('extractPayments')->times(1);
     $extractorMock->shouldReceive('getPayments')->times(1)->andReturn($payments);
     $this->_mapper->setExtractor($extractorMock);
     $mapped = $this->_mapper->map($invoices, 'file_is_mocked.csv', 'TH6');
     $this->assertEquals(3, $mapped->count());
     for ($i = 0; $i < 3; $i++) {
         $this->assertEquals($invoices->offsetGet($i), $mapped->offsetGet($i)->getRelatedInvoice());
         $this->assertEquals($invoices->offsetGet($i)->getAmount(), $mapped->offsetGet($i)->getAmount());
     }
 }
开发者ID:Shmarkus,项目名称:PIM,代码行数:25,代码来源:MapperImplTest.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Exporting databases');
     $io->section('Exporting all databases');
     $strategies = $this->collectorDbStrategy->collectDatabasesStrategies();
     $totalStrategies = count($strategies);
     $io->writeln($totalStrategies . ' strategie(s) found.');
     $progressBar = new ProgressBar($output, $totalStrategies);
     $progressBar->setFormat(self::PROGRESS_BAR_FORMAT);
     $progressBar->setMessage('Beginning backuping');
     $this->eventDispatcher->dispatch(Events::BACKUP_BEGINS, new BackupBeginsEvent($output));
     $progressBar->start();
     $reportContent = new \ArrayObject();
     foreach ($strategies as $strategy) {
         $strategyIdentifier = $strategy->getIdentifier();
         $setProgressBarMessage = function ($message) use($progressBar, $strategyIdentifier) {
             $message = "[{$strategyIdentifier}] {$message}";
             $progressBar->setMessage($message);
             $progressBar->display();
         };
         $exportedFiles = $this->processorDatabaseDumper->dump($strategy, $setProgressBarMessage);
         $reportContent->append("Backuping of the database: {$strategyIdentifier}");
         foreach ($exportedFiles as $file) {
             $filename = $file->getPath();
             $reportContent->append("\t→ {$filename}");
         }
         $progressBar->advance();
     }
     $progressBar->finish();
     $io->newLine(2);
     $io->section('Report');
     $io->text($reportContent->getArrayCopy());
     $this->eventDispatcher->dispatch(Events::BACKUP_ENDS, new BackupEndsEvent($output));
 }
开发者ID:Viscaweb,项目名称:EasyBackups,代码行数:35,代码来源:DatabaseDumperCommand.php

示例3: filterById

 /**
  * Set ID of messages to delete.
  *
  * This id was returned after sending message.
  *
  * @param $id
  * @return $this
  * @throws ActionException
  */
 public function filterById($id)
 {
     if (!is_string($id)) {
         throw new ActionException('Invalid value id');
     }
     $this->id->append($id);
     return $this;
 }
开发者ID:kaloryfer,项目名称:smsapi-php-client,代码行数:17,代码来源:Delete.php

示例4: filterById

 /**
  * Set ID of messages to delete.
  *
  * This id was returned after sending message.
  *
  * @param $id
  * @return $this
  * @throws \TMSolution\SmsBundle\Api\SMSApi\Exception\ActionException
  */
 public function filterById($id)
 {
     if (!is_string($id)) {
         throw new \TMSolution\SmsBundle\Api\SMSApi\Exception\ActionException('Invalid value id');
     }
     $this->id->append($id);
     return $this;
 }
开发者ID:TMSolution,项目名称:SmsBundle,代码行数:17,代码来源:Delete.php

示例5: section

 /**
  * @return \Nano\Route\Section\Common
  * @param string $location
  *
  * @throws \Nano\Exception
  */
 public function section($location)
 {
     $result = self::create($location);
     $this->sections->append($result);
     $result->setParent($this);
     $result->module($this->module);
     $result->suffix($this->suffix);
     return $result;
 }
开发者ID:visor,项目名称:nano,代码行数:15,代码来源:Common.php

示例6: foreach

 /**
  * @param $data
  */
 function __construct($data)
 {
     parent::__construct($data);
     $this->list = new \ArrayObject();
     if (isset($this->obj->list)) {
         foreach ($this->obj->list as $res) {
             $this->list->append(new GroupResponse($res));
         }
     }
 }
开发者ID:rafalszewc,项目名称:smsapi-opencart,代码行数:13,代码来源:GroupsResponse.php

示例7: foreach

 /**
  * @param $data
  */
 function __construct($data)
 {
     parent::__construct($data);
     $this->list = new \ArrayObject();
     if (isset($this->obj->list)) {
         foreach ($this->obj->list as $res) {
             $this->list->append(new MessageResponse($res->id, $res->points, $res->number, $res->status, $res->error, $res->idx));
         }
     }
 }
开发者ID:TMSolution,项目名称:SmsBundle,代码行数:13,代码来源:StatusResponse.php

示例8: add

 /**
  * Adds a new Object to Collection
  *
  * @param Next\Components\Object $object
  *   Object to add to Collection
  *
  * @return Next\Components\Iterator\AbstractCollection
  *   Collection Object (Fluent Interface)
  */
 public function add(Object $object)
 {
     if ($this->accept($object)) {
         // Adding Object...
         $this->collection->append($object);
         // ... and a Reference to it
         $this->references->append($object->getHash());
     }
     return $this;
 }
开发者ID:nextframework,项目名称:next,代码行数:19,代码来源:AbstractCollection.php

示例9: getAll

 /**
  * @return \ArrayObject|DistributorItem[]
  */
 public function getAll()
 {
     if (!$this->items->count()) {
         if ($this->rawItems->count()) {
             foreach ($this->rawItems as $item) {
                 $this->items->append(new DistributorItem($item));
             }
         }
     }
     return $this->items;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:14,代码来源:Distributor.php

示例10: testShouldMatchNone

 public function testShouldMatchNone()
 {
     $invoices = new \ArrayObject();
     $invoice = new \Entities\SampleInvoice('100', '666/AA', '2015120508', '');
     $invoices->append($invoice);
     $payments = new \ArrayObject();
     $payments->append(new \Entities\Payment('48,00', 'RO1755898361', 'Arve nr. 905/IT', 'Company OÜ'));
     $payments->append(new \Entities\Payment('15,00', 'RO1756686260', 'Tellimus 365/PF', 'Firma AS'));
     $payments->append(new \Entities\Payment('85,20', 'RO1757162444', 'tellimus 353/PF 24,12,15', 'ISA JA POJAD OÜ'));
     $mapped = $this->comparator->compare($invoices, $payments);
     $this->assertEquals(0, $mapped->count());
 }
开发者ID:Shmarkus,项目名称:PIM,代码行数:12,代码来源:InvoicePaymentReferenceNoComparatorTest.php

示例11: addTag

 /**
  * Add a tag to the document
  * @param XmlTag $tag, element to add
  * @param bool $generateTree, if set to true recreates the original tree structure
  */
 public function addTag(XmlTag $tag, $generateTree = false)
 {
     if ($generateTree) {
         $parent = $this->getTagByTagId($tag->getParentTagId());
         if ($parent instanceof XmlTag) {
             $parent->getChildren()->append($tag);
         } else {
             $this->_tags->append($tag);
         }
     } else {
         $this->_tags->append($tag);
     }
 }
开发者ID:bizio,项目名称:xmlreader,代码行数:18,代码来源:XmlDocument.php

示例12: getDBParams

 public static function getDBParams($param)
 {
     $dbParams = new \ArrayObject();
     switch ($param) {
         case "oracledb":
             $dbParams->append(array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => '', 'dbname' => 'foo'));
             return $dbParams;
             break;
         default:
             $dbParams->append(array('driver' => 'pdo_mysql', 'user' => 'root', 'password' => '', 'dbname' => 'foo'));
             return $dbParams;
             break;
     }
 }
开发者ID:6975usa,项目名称:admin,代码行数:14,代码来源:DatabaseConfig.php

示例13: append

 public function append($geoCache)
 {
     if ($geoCache instanceof GeoCache) {
         parent::append($geoCache);
         $this->isReady = true;
     }
 }
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:7,代码来源:Collection.php

示例14: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Set filters & get data
     $type = $input->getArgument(self::TYPE_ARGUMENT);
     if ($type) {
         $this->productlist->setType($type);
     }
     $active = $input->getOption(self::ACTIVE_OPTION);
     if ($active) {
         $this->productlist->setStatus(1);
     }
     $products = $this->productlist->getProducts();
     // If only count, return it
     if ($input->getOption(self::COUNT_OPTION)) {
         return $output->writeln(sprintf('Count: %d', $products->getTotalCount()));
     }
     // Else prepare data for showing
     $types = $this->productlist->getProductTypesAssoc();
     $rows = new \ArrayObject();
     foreach ($products->getItems() as $id => $product) {
         $rows->append([$product->getId(), $product->getSku(), $product->getName(), $types[$product->getTypeId()]]);
     }
     // Output table layout
     $table = new Table($output);
     $table->setHeaders(['ID', 'SKU', 'Name', 'Type']);
     $table->setRows($rows->getArrayCopy());
     $table->render();
 }
开发者ID:stefandoorn,项目名称:magento2-console-productlist,代码行数:31,代码来源:ProductlistCommand.php

示例15: toArray

 /**
  * @param string $csv the file pathname
  * @param bool $object if true, returns array object, otherwise a plain array
  * @return ArrayObject
  * @throws Exception
  */
 public static function toArray($csv, $object = true)
 {
     if ($object == false) {
         $array = array();
     } else {
         $array = new ArrayObject();
     }
     if (!file_exists($csv)) {
         throw new Exception('CSV File not found', 404);
     }
     $file = new SplFileObject($csv);
     $file->setFlags(SplFileObject::READ_CSV);
     foreach ($file as $data) {
         $count = count($data);
         if ($object == false) {
             $item = array();
         } else {
             $item = new ArrayObject();
         }
         for ($x = 0; $x < $count; $x++) {
             if ($item instanceof ArrayObject) {
                 $item->append($data[$x]);
             } else {
                 array_push($item, $data[$x]);
             }
         }
         if ($array instanceof ArrayObject) {
             $array->append($item);
         } else {
             array_push($array, $item);
         }
     }
     return $array;
 }
开发者ID:delboy1978uk,项目名称:csv,代码行数:40,代码来源:Csv.php


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