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


PHP Object::toArray方法代码示例

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


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

示例1: duplicateLayout

 /**
  * Duplicate given object and copy files needed.
  * @param Object $origLayout
  */
 public function duplicateLayout($origLayout)
 {
     // Convert the orig layout to an array
     $origData = $origLayout->toArray();
     // Store this for later use
     $origType = $origData['layout_type'];
     // Unset pieces not needed and reset some pieces
     unset($origData['layout_id']);
     $origData['layout_type'] = Layouts_Model_Layout::CUSTOM;
     $layoutPath = $this->fetchLayoutPath($origType, $origData['layout_module']);
     // Set our source file
     $sourceFile = $layoutPath . $origLayout->createFilename($origData['layout_title_orig']);
     // New Path
     $newPath = $this->fetchLayoutPath(Layouts_Model_Layout::CUSTOM, $origData['layout_module']);
     // Make sure we don't have the same filename
     while (is_file($newPath . $origData['layout_filename'])) {
         $origData['layout_title'] .= ' copy';
         $origData['layout_filename'] = $origLayout->createFilename($origData['layout_title']);
     }
     $newFile = $newPath . $origData['layout_filename'];
     // Do the copy
     $copyResult = copy($sourceFile, $newFile);
     if (!$copyResult) {
         throw new FFR_Model_Exception('There was a problem copying the file.');
     }
     // Save the new DB record
     $newLayout = $this->create($origData);
     $newLayout->save();
     return true;
 }
开发者ID:rantoine,项目名称:AdvisorIllustrator,代码行数:34,代码来源:LayoutGateway.php

示例2: toArray

 /**
  * @return array
  */
 public function toArray()
 {
     $array = parent::toArray();
     $array['cells'] = array_map(function ($cell) {
         return $cell->toArray();
     }, $this->cells);
     return $array;
 }
开发者ID:yrizos,项目名称:table,代码行数:11,代码来源:Row.php

示例3: prepareParams

 /**
  * Prepare params.
  *
  * @return array $params
  */
 private function prepareParams()
 {
     $params = array_merge(['loginemail' => self::$loginemail, 'password' => self::$password], $this->object->toArray(), ['thumbnail";filename="' . $this->object->getThumbnail()->getFilename() => $this->object->getThumbnail()->getData()]);
     if ($this->object->getSubimage()) {
         foreach ($this->object->getSubimage() as $image) {
             $params['subimage[]";filename="' . $image->getFilename()] = $image->getData();
         }
     }
     return $params;
 }
开发者ID:nnrudakov,项目名称:glabs,代码行数:15,代码来源:TransportZoheny.php

示例4: send

 /**
  * Send object.
  *
  * @param bool $isTest
  *
  * @return bool
  *
  * @throws TransportException
  * @throws InvalidParamException
  * @throws ImageException
  */
 public function send($isTest = false)
 {
     $params = $this->object->toArray();
     $aboutme = $params['aboutme'];
     unset($params['aboutme']);
     if ($isTest) {
         return true;
     }
     $this->object->setUploadedLink();
     $response = $this->request(self::$url . self::$registerApi, $params);
     $params = ['token' => $response['data']['token']];
     $params['property'] = 'aboutme';
     $params['value'] = $aboutme;
     $this->request(self::$url . self::$aboutmeApi, $params);
     /*if ($this->object->getThumbnail()) {
           $photo = $this->object->getThumbnail();
           $response = $this->request(self::$url . self::$uploadApi, ['file' => new \CURLFile($photo->getLocalFile())]);
           $this->request(self::$url . self::$photoApi, ['token' => $response['data']['token'], 'photo' => $response]);
       }*/
     return true;
 }
开发者ID:nnrudakov,项目名称:glabs,代码行数:32,代码来源:TransportChatapp.php

示例5: toArray

 public function toArray()
 {
     $array = parent::toArray();
     if (array_key_exists('Cheaters', $array)) {
         $array = array_merge($array, $array['Cheaters']);
     }
     return $array;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:8,代码来源:Node.php

示例6: toArray

 public function toArray()
 {
     // remove sensitive stuff
     return array_diff_key(parent::toArray(), array("id" => true, "password" => true));
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:5,代码来源:users.php

示例7: toArray

 /**
  * @return array
  */
 public function toArray()
 {
     $header = $this->getHeader();
     $rows = $this->getRows();
     $c_header = count($header);
     $c_rows = !empty($rows) ? max(array_map('count', $rows)) : 0;
     $c_max = max($c_header, $c_rows);
     $header = self::fillRow($header, $c_max)->toArray();
     $rows = array_map(function ($row) use($c_max) {
         return self::fillRow($row, $c_max)->toArray();
     }, $rows);
     $array = parent::toArray();
     $array['header'] = $header;
     $array['rows'] = $rows;
     return $array;
 }
开发者ID:yrizos,项目名称:table,代码行数:19,代码来源:Table.php


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