コード例 #1
0
ファイル: AController.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Call controller action
  *
  * @return void
  */
 protected function callAction()
 {
     $action = $this->getAction();
     $method = 'doAction' . \Includes\Utils\Converter::convertToPascalCase($action);
     if (method_exists($this, $method)) {
         // Call method doAction<action-name-in-camel-case>
         $this->{$method}();
     } else {
         \XLite\Logger::getInstance()->log('Handler for the action "' . $action . '" is not defined for the "' . get_class($this) . '" class');
     }
     $this->actionPostprocess($action);
 }
コード例 #2
0
ファイル: Marketplace.php プロジェクト: kingsj/core
 /**
  * Prepare the marketplace response
  *
  * @param \PEAR2\HTTP\Request\Response $response Response to prepare
  * @param string                       $action   Current action
  *
  * @return mixed
  */
 protected function prepareResponse(\PEAR2\HTTP\Request\Response $response, $action)
 {
     $result = null;
     $method = 'ResponseFor' . \Includes\Utils\Converter::convertToPascalCase($action) . 'Action';
     if (200 == $response->code) {
         if (isset($response->body)) {
             $result = $this->{'parse' . $method}($response);
         } else {
             $this->logError($action, 'An empty response received');
         }
     } else {
         $this->logError($action, 'Returned the "{{code}}" code', array('code' => $response->code));
     }
     if (is_array($result)) {
         if ($this->{'validate' . $method}($result)) {
             if (method_exists($this, 'prepare' . $method)) {
                 $result = $this->{'prepare' . $method}($result);
             }
             $this->logInfo($action, 'Valid response received', array(), $result);
         } else {
             $this->logError($action, 'Response has an invalid format', array(), $result);
             $result = null;
         }
     }
     return $result;
 }
コード例 #3
0
ファイル: AView.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Compares two values
  * @deprecated Used only in deprecated class (\XLite\View\MembershipSelect)
  *
  * @param mixed $val1 Value 1
  * @param mixed $val2 Value 2
  * @param mixed $val3 Value 3 OPTIONAL
  *
  * @return boolean
  */
 protected function isSelected($val1, $val2, $val3 = null)
 {
     if (null !== $val1 && null !== $val3) {
         $method = 'get';
         if ($val1 instanceof \XLite\Model\AEntity) {
             $method .= \Includes\Utils\Converter::convertToPascalCase($val2);
         }
         // Get value with get() method and compare it with third value
         $result = $val1->{$method}() == $val3;
     } else {
         $result = $val1 == $val2;
     }
     return $result;
 }
コード例 #4
0
ファイル: CategoryAbstract.php プロジェクト: kewaunited/xcart
 /**
  * Update quick flags for a category
  *
  * @param \XLite\Model\Category $entity Category
  * @param array                 $flags  Flags to set
  *
  * @return void
  */
 protected function updateQuickFlags(\XLite\Model\Category $entity, array $flags)
 {
     $quickFlags = $entity->getQuickFlags();
     if (!isset($quickFlags)) {
         $quickFlags = new \XLite\Model\Category\QuickFlags();
         $quickFlags->setCategory($entity);
         $entity->setQuickFlags($quickFlags);
     }
     foreach ($flags as $name => $delta) {
         $name = \Includes\Utils\Converter::convertToPascalCase($name);
         $quickFlags->{'set' . $name}($quickFlags->{'get' . $name}() + $delta);
     }
 }
コード例 #5
0
ファイル: AEntity.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Get entity unique identifier value
  *
  * @return integer
  */
 public function getUniqueIdentifier()
 {
     return $this->{'get' . \Includes\Utils\Converter::convertToPascalCase($this->getUniqueIdentifierName())}();
 }
コード例 #6
0
ファイル: Mailer.php プロジェクト: kewaunited/xcart
 /**
  * Return variable value
  *
  * @param string $name Variable name
  *
  * @return string
  */
 protected function getVariableValue($name)
 {
     $result = '';
     $methodName = __FUNCTION__ . \Includes\Utils\Converter::convertToPascalCase($name);
     if (method_exists($this, $methodName)) {
         $result = $this->{$methodName}($name);
     } elseif (0 === strpos($name, 'company')) {
         $result = $this->getVariableValueCompany($name);
     }
     return $result;
 }