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


PHP Change类代码示例

本文整理汇总了PHP中Change的典型用法代码示例。如果您正苦于以下问题:PHP Change类的具体用法?PHP Change怎么用?PHP Change使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: process

 public function process(&$return, $req)
 {
     $cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
     $cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
     $cf->setIsExecuted(true);
     $return['data'] = $cf->getAsyncStatus();
 }
开发者ID:CoreylDagget,项目名称:dbc,代码行数:7,代码来源:ActionMarkAsExecuted.class.php

示例2: process

 public function process(&$return, $req)
 {
     $cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
     $cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
     //only if the setting api_execute_async is true and execution_mode is web, then execute it async
     $async = $this->settings->getApiExecuteAsync() && DBC_EXECUTION_MODE == 'web';
     $return['data'] = $cf->executeSql($async);
 }
开发者ID:CoreylDagget,项目名称:dbc,代码行数:8,代码来源:ActionExecuteSql.class.php

示例3: test_for_pennies

 function test_for_pennies()
 {
     //Arrange
     $test_user_input = new Change();
     $user_change = 4;
     //Act
     $result = $test_user_input->giveChange($user_change);
     //Assert
     $this->assertEquals([0, 0, 0, 4], $result);
 }
开发者ID:jsween,项目名称:change_machine_php,代码行数:10,代码来源:AnagramTest.php

示例4: test_getPennies

 function test_getPennies()
 {
     // Arrange
     $new_Change = new Change();
     $input = 46;
     // Act
     $result = $new_Change->makeChange($input);
     // Assert
     $this->assertEquals("quarters:1 dimes:2 nickels:0 pennies:1", $result);
 }
开发者ID:eddieduro,项目名称:change-calc-php,代码行数:10,代码来源:ChangeTest.php

示例5: test_calculateOneQuarterOneDimeOneNickelFourPennies

 function test_calculateOneQuarterOneDimeOneNickelFourPennies()
 {
     //Arrange
     $test_Change = new Change();
     $input = 44;
     //Act
     $result = $test_Change->calculateChange($input);
     //Assert
     $this->assertEquals(array('pennies' => 4, 'nickels' => 1, 'dimes' => 1, 'quarters' => 1), $result);
 }
开发者ID:Jordan-Meier,项目名称:coin-counter-PHP,代码行数:10,代码来源:ChangeTest.php

示例6: canCreateItem

 /**
  * Is the current user have right to create the current task ?
  *
  * @return boolean
  **/
 function canCreateItem()
 {
     if (!parent::canReadITILItem()) {
         return false;
     }
     $change = new Change();
     if ($change->getFromDB($this->fields['changes_id'])) {
         return Session::haveRight('change', UPDATE) || Session::haveRight('change', Change::READMY) && ($change->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $change->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']));
     }
     return false;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:16,代码来源:changetask.class.php

示例7: run

 public function run($context)
 {
     $changes = changes_eurotlx();
     $change = new Change();
     $change->data = date('Y-m-d H:i:s');
     foreach ($changes as $key => $val) {
         $change->{$key} = $val;
     }
     $change->_force_create = TRUE;
     $change->save();
     printf("%s saved currency change rates\n", get_called_class());
 }
开发者ID:emeraldion,项目名称:creso,代码行数:12,代码来源:eurotlx_exchange_rate_fetcher_agent.php

示例8: _populate_transactions

 function _populate_transactions()
 {
     $conn = $this->get_connection();
     if (count($this->transactions) > 0) {
         foreach ($this->transactions as $transaction) {
             $transaction->stock = new Stock();
             $transaction->stock->find_by_id($transaction->isin);
             $transaction->importo = 0;
             $parts = $transaction->find_all(array('where_clause' => "`negot_id` = '{$conn->escape($transaction->negot_id)}'"));
             if (count($parts) > 0) {
                 foreach ($parts as $part) {
                     $importo = $part->quantita * $part->prezzo;
                     $importo /= $transaction->stock->divisa == 'USD' ? Change::usd2eur($part->data) : 1;
                     $importo *= $part->azione == 'acquisto' ? -1 : 1;
                     $importo /= $transaction->stock->tipo == 'obbligazione' ? 100 : 1;
                     $comm = abs($importo) * $this->preference->comm_percent;
                     if (strtotime($part->data) >= strtotime("2007-08-01")) {
                         $comm = $comm > $this->preference->comm_percent_min ? $comm : $this->preference->comm_percent_min;
                     }
                     $importo -= $comm;
                     $importo -= $this->preference->comm_fissa;
                     $transaction->importo += $importo;
                 }
             }
             $this->bilancio += $transaction->importo;
         }
     }
 }
开发者ID:emeraldion,项目名称:creso,代码行数:28,代码来源:ricavi_controller.php

示例9: importo_eur

 public function importo_eur()
 {
     if (!isset($this->importo_eur)) {
         $this->importo_eur = Change::convert($this->importo, $this->stock->divisa, date('Y-m-d', $this->timestamp));
     }
     return $this->importo_eur;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:7,代码来源:payment.php

示例10: roi_with_timeline

 public static function roi_with_timeline($isin, $username, $month_from, $month_to)
 {
     $conn = Db::get_connection();
     $stock = new Stock();
     if (!$stock->find_by_id($isin)) {
         return;
     }
     $portfolio_stock_factory = new PortfolioStock();
     $portfolio_stocks = $portfolio_stock_factory->find_all(array('where_clause' => "`isin` = '{$conn->escape($isin)}' " . "AND `utente` = '{$conn->escape($username)}'"));
     if (count($portfolio_stocks) == 0) {
         return;
     }
     $portfolio_stock = $portfolio_stocks[0];
     $quantita = self::quantita_history($isin, $username, $month_from);
     switch ($stock->tipo) {
         case 'obbligazione':
             $investito = $portfolio_stock->prezzo * $portfolio_stock->quantita / 100;
             break;
         default:
             $investito = $portfolio_stock->prezzo * $portfolio_stock->quantita;
     }
     $investito = Change::convert($investito, $stock->divisa);
     $roi = PianificatoreHelper::roi_with_timeline($isin, $quantita, $month_from, $month_to, $investito);
     foreach ($roi->payments as $payment) {
         $payment->portfolio_stock = $portfolio_stock;
     }
     // print_r($roi);
     return $roi;
 }
开发者ID:emeraldion,项目名称:creso,代码行数:29,代码来源:portfolio_helper.php

示例11: index

 /**
  *  Action methods
  */
 public function index()
 {
     //$this->last = Change::usd2eur();
     $conn = $this->get_connection();
     $yesterday = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) - 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
     $tomorrow = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) + 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
     $change = new Change();
     $changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `usd2eur` DESC ' . 'LIMIT 1');
     $this->day_max = $changes[0];
     $changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `usd2eur` ASC ' . 'LIMIT 1');
     $this->day_min = $changes[0];
     $changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` ASC ' . 'LIMIT 1');
     $this->open = $changes[0];
     $changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` DESC ' . 'LIMIT 1');
     $this->last = $changes[0];
     $this->redirect_to(array_merge($_REQUEST, array('query_string' => $this->request->querystring, 'after' => 300)));
 }
开发者ID:emeraldion,项目名称:creso,代码行数:20,代码来源:cambi_controller.php

示例12: _partitionByType

 /**
  * Returns the changes partitioned by change type.
  *
  * @return array An array of type => array of changes.
  */
 protected function _partitionByType()
 {
     $types = Change::types();
     $result = array_combine(array_keys($types), array_fill(0, count($types), []));
     foreach ($this->_changes as $change) {
         $result[$change->getType()][] = $change;
     }
     return array_filter($result);
 }
开发者ID:guywithnose,项目名称:release-notes,代码行数:14,代码来源:ChangeList.php

示例13: test_accessors

 public function test_accessors()
 {
     /** === Test Data === */
     $CUST_ID = 'cust ID';
     $DATE_CHANGED = 'changed at';
     $ID = 'id';
     $PARENT_ID = 'id';
     /** === Call and asserts  === */
     $this->obj->setCustomerId($CUST_ID);
     $this->obj->setDateChanged($DATE_CHANGED);
     $this->obj->setId($ID);
     $this->obj->setParentId($PARENT_ID);
     $this->assertEquals($CUST_ID, $this->obj->getCustomerId());
     $this->assertEquals($DATE_CHANGED, $this->obj->getDateChanged());
     $this->assertEquals($ID, $this->obj->getId());
     $this->assertEquals($PARENT_ID, $this->obj->getParentId());
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_downline,代码行数:17,代码来源:Change_Test.php

示例14: process

 public function process(&$return, $req)
 {
     if (DBC_EXECUTION_MODE != 'cli') {
         throw new Exception('runAll is only valid in CLI mode.');
     }
     parent::process($return, $req);
     $cardStack = (array) $return['data'];
     $cardStack = array_reverse($cardStack);
     //execute in reverse order
     $errCount = 0;
     $cardCount = sizeof($cardStack);
     foreach ($cardStack as $entry) {
         try {
             $changeFile = $entry['file'];
             $cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
             $cf->parseFile($changeFile);
             try {
                 if (!$cf->doExecuteSql()) {
                     $errStat = $cf->getAsyncStatus();
                     throw new Exception($errStat['message']);
                 }
                 echo '[DONE] ' . $changeFile . PHP_EOL;
             } catch (Exception $e) {
                 $errCount++;
                 echo '[FAILED] ' . $changeFile . ' :: ' . $e->getMessage() . PHP_EOL;
                 echo $cf->getSql() . PHP_EOL;
                 if (in_array('--force', $req) || in_array('-f', $req)) {
                     try {
                         $cf->failedToExecuted();
                         echo '[IGNORE] ' . $changeFile . PHP_EOL;
                     } catch (Exception $e) {
                         echo '[FAILED] ' . $changeFile . ' IGNORE FAILED :: ' . $e->getMessage() . PHP_EOL;
                     }
                 }
             }
         } catch (Execution $e) {
             echo '[FAILED] ' . $changeFile . ' Unrecoverable error :: ' . $e->getMessage() . PHP_EOL;
         }
         if (sizeof($cf->getExecute())) {
             echo '[IGNORE] ' . $changeFile . ' PATCHES: ' . implode(', ', $cf->getExecute()) . PHP_EOL;
         }
     }
     $return['data'] = PHP_EOL . '*** FINISHED ' . $cardCount . ' CHANGES' . ($errCount ? ' WITH ' . $errCount . ' FAIL(S)' : ' SUCCESSFULLY');
     $return['status'] = 'ok';
 }
开发者ID:CoreylDagget,项目名称:dbc,代码行数:45,代码来源:ActionRunAll.class.php

示例15: store

 /**
  * @param ChangeFile $cf
  * @param bool $overwrite
  * @throws Exception
  */
 public function store(Change $cf, $overwrite = true)
 {
     if ($cf->getIssueNumber() == '') {
         throw new Exception('Issue# is empty.');
     }
     if ((int) $cf->getIssueCount() == 0) {
         throw new Exception('Issue Count is empty.');
     }
     $filename = $cf->generateFilename($cf->getIssueNumber(), $cf->getIssueCount());
     if (!$overwrite) {
         if (parent::fileExists($this->getDir(self::FILE_ROOT), $filename)) {
             throw new Exception('Change already exists.');
         }
     }
     parent::save($this->getDir(self::FILE_ROOT), $filename, $cf->stringify());
 }
开发者ID:CoreylDagget,项目名称:dbc,代码行数:21,代码来源:ChangeFile.class.php


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