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


PHP Object::write方法代码示例

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


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

示例1: test_createFileFirst

 /**
  * Test Creating the file first
  *
  * @return void
  * @author Dan Cox
  */
 public function test_createFileFirst()
 {
     $this->fs->shouldReceive('exists')->andReturn(FALSE);
     $this->config->shouldReceive('create')->andReturn($this->config);
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->shouldReceive('save');
     $this->log->write('file.yml', 'logname', array('data' => array()));
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:LogTest.php

示例2: execute

 /**
  * Executa comando
  *
  * @param Object $oInput
  * @param Object $oOutput
  * @access public
  * @return void
  */
 public function execute($oInput, $oOutput)
 {
     $oOutput->write("baixando atualizações...\r");
     $oComando = $this->getApplication()->execute('cvs update -dRP');
     $aRetornoComandoUpdate = $oComando->output;
     $iStatusComandoUpdate = $oComando->code;
     /**
      * Caso CVS encontre conflito, retorna erro 1
      */
     if ($iStatusComandoUpdate > 1) {
         $oOutput->writeln('<error>Erro nº ' . $iStatusComandoUpdate . ' ao execurar cvs update -dR:' . "\n" . $this->getApplication()->getLastError() . '</error>');
         return $iStatusComandoUpdate;
     }
     $oOutput->writeln(str_repeat(' ', \Shell::columns()) . "\r" . "Atualizações baixados");
     $sComandoRoot = '';
     /**
      * Senha do root
      */
     $sSenhaRoot = $this->getApplication()->getConfig('senhaRoot');
     /**
      * Executa comando como root 
      * - caso for existir senha no arquivo de configuracoes
      */
     if (!empty($sSenhaRoot)) {
         $sComandoRoot = "echo '{$sSenhaRoot}' | sudo -S ";
     }
     $oComando = $this->getApplication()->execute($sComandoRoot . 'chmod 777 -R ' . getcwd());
     $aRetornoComandoPermissoes = $oComando->output;
     $iStatusComandoPermissoes = $oComando->code;
     if ($iStatusComandoPermissoes > 0) {
         throw new Exception("Erro ao atualizar permissões dos arquivos, configura a senha do root: cvsgit config -e");
     }
 }
开发者ID:renanrmelo,项目名称:cvsgit,代码行数:41,代码来源:PullCommand.php

示例3: array

 /**
  * POST Request
  *
  * @return Mixed data retrieved from Request
  **/
 function _post(&$Model, $params = array())
 {
     $postHeaders = array('Host' => $this->_host, 'Connection' => 'Close', 'Content-Length' => strlen($this->_data));
     $params['headers'] = array_merge($params['headers'], $postHeaders);
     if (!isset($params['headers']['Content-Type'])) {
         $params['headers']['Content-Type'] = 'application/x-www-form-urlencoded';
     }
     $this->_formatHeaders($params['headers']);
     $request = "POST {$this->_path} HTTP/1.0\r\n";
     $request .= $this->_headers . "\r\n";
     $request .= "\r\n";
     $request .= $this->_data;
     $this->__setInfo('requestHeaders', $request);
     $this->Socket->write($request);
     $response = '';
     while ($data = $this->Socket->read()) {
         $response .= $data;
     }
     $this->_parseResponse($response);
     if ($this->__settings[$Model->name]['followRedirect'] && array_key_exists('Location', $this->response['headers'])) {
         $this->serviceConnect($Model, $this->response['headers']['Location'], $params);
         $this->_data = null;
         $this->_get($Model, $params);
     }
     return $this->response['body'];
 }
开发者ID:barraemme,项目名称:waterwall,代码行数:31,代码来源:webservice.php

示例4: iexec

 /**
  * Opens an interactive shell if not done already and transmits commands and returns output.
  *
  * @access public
  * @param string $command Command to execute
  * @param string $expect String of output to expect and remove from output.
  * @param bool $expectregex Switches string expectation to regular expressions.
  * @returns bool|string
  */
 public function iexec($command, $expect = "", $expectregex = false)
 {
     trim($command, "\n");
     if ($this->sshobject->write($command . "\n")) {
         return $this->sshobject->read($expect, $expectregex ? NET_SSH . $this->protocol . _READ_REGEX : NET_SSH . $this->protocol . _READ_SIMPLE);
     } else {
         return false;
     }
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:18,代码来源:SSH.php

示例5: currentOrder

 /**
  * Gets or creates the current order.
  * IMPORTANT FUNCTION!
  * @todo - does this need to be public????
  * @return void
  */
 public function currentOrder()
 {
     if (!$this->order) {
         $sessionVariableName = $this->sessionVariableName("OrderID");
         $orderIDFromSession = intval(Session::get($sessionVariableName));
         if ($orderIDFromSession > 0) {
             $this->order = DataObject::get_by_id("Order", $orderIDFromSession);
         }
         //order has already been submitted - immediately remove it because we dont want to change it.
         $member = Member::currentUser();
         if ($this->order) {
             //first reason to set to null: it is already submitted
             if ($this->order->IsSubmitted()) {
                 $this->order = null;
             } elseif (!$this->order->canView()) {
                 $this->order = null;
             } elseif ($member && $member->exists()) {
                 if ($this->order->MemberID != $member->ID) {
                     $updateMember = false;
                     if (!$this->order->MemberID) {
                         $updateMember = true;
                     }
                     if (!$member->IsShopAdmin()) {
                         $updateMember = true;
                     }
                     if ($updateMember) {
                         $this->order->MemberID = $member->ID;
                         $this->order->write();
                     }
                 }
                 //current order has nothing in it AND the member already has an order: use the old one first
                 if ($this->order->StatusID) {
                     $firstStep = DataObject::get_one("OrderStep");
                     //we assume the first step always exists.
                     //TODO: what sort order?
                     $previousOrderFromMember = DataObject::get_one("Order", "\r\n\t\t\t\t\t\t\t\t\"MemberID\" = " . $member->ID . "\r\n\t\t\t\t\t\t\t\tAND (\"StatusID\" = " . $firstStep->ID . " OR \"StatusID\" = 0)\r\n\t\t\t\t\t\t\t\tAND \"Order\".\"ID\" <> " . $this->order->ID);
                     if ($previousOrderFromMember && $previousOrderFromMember->canView()) {
                         if ($previousOrderFromMember->StatusID) {
                             $this->order->delete();
                             $this->order = $previousOrderFromMember;
                         } else {
                             $previousOrderFromMember->delete();
                         }
                     }
                 }
             }
         }
         if (!$this->order) {
             if ($member) {
                 $firstStep = DataObject::get_one("OrderStep");
                 $previousOrderFromMember = DataObject::get_one("Order", "\"MemberID\" = " . $member->ID . " AND (\"StatusID\" = " . $firstStep->ID . " OR \"StatusID\" = 0)");
                 if ($previousOrderFromMember) {
                     if ($previousOrderFromMember->canView()) {
                         $this->order = $previousOrderFromMember;
                     }
                 }
             }
             if (!$this->order) {
                 //here we cleanup old orders, because they should be cleaned at the same rate that they are created...
                 $cleanUpEveryTime = EcommerceConfig::get("ShoppingCart", "cleanup_every_time");
                 if ($cleanUpEveryTime) {
                     $obj = new CartCleanupTask();
                     $obj->runSilently();
                 }
                 //create new order
                 $this->order = new Order();
                 if ($member) {
                     $this->order->MemberID = $member->ID;
                 }
                 $this->order->write();
             }
             Session::set($sessionVariableName, intval($this->order->ID));
         }
         //member just logged in and is not associated with order yet
         //if you are not logged in but the order belongs to a member then clear the cart.
         /***** THIS IS NOT CORRECT, BECAUSE YOU CAN CREATE AN ORDER FOR A USER AND NOT BE LOGGED IN!!! ***
         			elseif($this->order->MemberID && !$member) {
         				$this->clear();
         				return false;
         			}
         			*/
         if ($this->order && $this->order->exists() && $this->order->StatusID) {
             $this->order->calculateOrderAttributes();
         }
     }
     return $this->order;
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:93,代码来源:ShoppingCart.php

示例6: setRequestBody

 /**
  * bodyを設定 POST, PUTなど
  *
  * @param String $body // 投げるJSON
  * @return void
  */
 protected function setRequestBody($body)
 {
     $this->body->write($body);
     $this->body->rewind();
 }
开发者ID:kobabasu,项目名称:rest-slim,代码行数:11,代码来源:AppMock.php

示例7: cache

 /**
  * Caches the compiled container
  *
  * @return DI
  * @author Dan Cox
  */
 public function cache()
 {
     $dump = new PhpDumper(static::$container);
     $this->cache->write($dump->dump(['class' => $this->cache_class, 'namespace' => $this->cache_namespace]), static::$container->getResources());
     return $this;
 }
开发者ID:antoligy,项目名称:Framework,代码行数:12,代码来源:DI.php

示例8: parse

 /**
  * @param  SplFileInfo $file
  * @param  string      $reg_exp
  * @param  Object      $output
  * 
  * @return array
  */
 public function parse(SplFileInfo $file, $reg_exp, $output)
 {
     $parsed = array();
     $f = $file->openFile();
     while (!$f->eof()) {
         $line = $f->current();
         if (preg_match($reg_exp, $line, $data)) {
             $parsed[] = $data;
         } elseif ($output) {
             $output->write($line);
         }
         $f->next();
     }
     return $parsed;
 }
开发者ID:pigroupe,项目名称:SfynxToolBundle,代码行数:22,代码来源:PiFileSplManager.php

示例9: currentOrder

 /**
  * Gets or creates the current order.
  * Based on the session ONLY!
  * IMPORTANT FUNCTION!
  * @todo - does this need to be public????
  * @return void
  */
 public function currentOrder($recurseCount = 0)
 {
     if (!$this->order) {
         $sessionVariableName = $this->sessionVariableName("OrderID");
         $orderIDFromSession = intval(Session::get($sessionVariableName));
         if ($orderIDFromSession > 0) {
             $this->order = Order::get()->byID($orderIDFromSession);
         }
         $member = Member::currentUser();
         if ($this->order) {
             //first reason to set to null: it is already submitted
             if ($this->order->IsSubmitted()) {
                 $this->order = null;
             } elseif (!$this->order->canView()) {
                 $this->order = null;
             } elseif ($member && $member->exists()) {
                 if ($this->order->MemberID != $member->ID) {
                     $updateMember = false;
                     if (!$this->order->MemberID) {
                         $updateMember = true;
                     }
                     if (!$member->IsShopAdmin()) {
                         $updateMember = true;
                     }
                     if ($updateMember) {
                         $this->order->MemberID = $member->ID;
                         $this->order->write();
                     }
                 }
                 //IF current order has nothing in it AND the member already has an order: use the old one first
                 //first, lets check if the current order is worthwhile keeping
                 if ($this->order->StatusID || $this->order->TotalItems()) {
                     //do NOTHING!
                 } else {
                     $firstStep = OrderStep::get()->First();
                     //we assume the first step always exists.
                     //TODO: what sort order?
                     $count = 0;
                     while ($firstStep && ($previousOrderFromMember = Order::get()->where("\r\n\t\t\t\t\t\t\t\t\t\"MemberID\" = " . $member->ID . "\r\n\t\t\t\t\t\t\t\t\tAND (\"StatusID\" = " . $firstStep->ID . " OR \"StatusID\" = 0)\r\n\t\t\t\t\t\t\t\t\tAND \"Order\".\"ID\" <> " . $this->order->ID)->First())) {
                         //arbritary 12 attempts ...
                         if ($count > 12) {
                             break;
                         }
                         $count++;
                         if ($previousOrderFromMember && $previousOrderFromMember->canView()) {
                             if ($previousOrderFromMember->StatusID || $previousOrderFromMember->TotalItems()) {
                                 $this->order->delete();
                                 $this->order = $previousOrderFromMember;
                                 break;
                             } else {
                                 $previousOrderFromMember->delete();
                             }
                         }
                     }
                 }
             }
         }
         if (!$this->order) {
             if ($member) {
                 $firstStep = OrderStep::get()->First();
                 if ($firstStep) {
                     $previousOrderFromMember = Order::get()->filter(array("MemberID" => $member->ID, "StatusID" => array($firstStep->ID, 0)))->First();
                     if ($previousOrderFromMember) {
                         if ($previousOrderFromMember->canView()) {
                             $this->order = $previousOrderFromMember;
                         }
                     }
                 }
             }
             if ($this->order && !$this->order->exists()) {
                 $this->order = null;
             }
             if (!$this->order) {
                 //here we cleanup old orders, because they should be
                 //cleaned at the same rate that they are created...
                 if (EcommerceConfig::get("ShoppingCart", "cleanup_every_time")) {
                     $cartCleanupTask = EcommerceTaskCartCleanup::create();
                     $cartCleanupTask->runSilently();
                 }
                 //create new order
                 $this->order = Order::create();
                 if ($member) {
                     $this->order->MemberID = $member->ID;
                 }
                 $this->order->write();
             }
             Session::set($sessionVariableName, intval($this->order->ID));
         } elseif ($this->order->MemberID && !$member) {
             $this->clear();
             $this->order = null;
         }
         if ($this->order && $this->order->exists()) {
             $this->order->calculateOrderAttributes($force = false);
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:101,代码来源:ShoppingCart.php


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