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


PHP object::getCode方法代码示例

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


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

示例1: render

 /**
  * Render the document
  *
  * @param   boolean  $cache   If true, cache the output
  * @param   array    $params  Associative array of attributes
  *
  * @return  string   The rendered data
  *
  * @since   11.1
  */
 public function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (!isset($this->_error)) {
         return;
     }
     //Set the status header
     JResponse::setHeader('status', $this->_error->getCode() . ' ' . str_replace("\n", ' ', $this->_error->getMessage()));
     $file = 'error.php';
     // check template
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = isset($params['template']) ? JFilterInput::getInstance()->clean($params['template'], 'cmd') : 'system';
     if (!file_exists($directory . '/' . $template . '/' . $file)) {
         $template = 'system';
     }
     //set variables
     $this->baseurl = JURI::base(true);
     $this->template = $template;
     $this->debug = isset($params['debug']) ? $params['debug'] : false;
     $this->error = $this->_error;
     // load
     $data = $this->_loadTemplate($directory . '/' . $template, $file);
     parent::render();
     return $data;
 }
开发者ID:Radek-Suski,项目名称:joomla-platform,代码行数:35,代码来源:error.php

示例2: render

 /**
  * Render the document
  *
  * @param   boolean  $cache   If true, cache the output
  * @param   array    $params  Associative array of attributes
  *
  * @return  string   The rendered data
  *
  * @since   11.1
  */
 public function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (isset($this->_error)) {
         $code = $this->_error->getCode();
         if (!isset(JHttpResponse::$status_messages[$code])) {
             $code = '500';
         }
         if (ini_get('display_errors')) {
             $message = $this->_error->getMessage();
         } else {
             $message = JHttpResponse::$status_messages[$code];
         }
         // Set the status header
         JFactory::getApplication()->setHeader('status', $code . ' ' . str_replace("\n", ' ', $message));
         $file = 'error.php';
         // Check template
         $directory = isset($params['directory']) ? $params['directory'] : 'templates';
         $template = isset($params['template']) ? JFilterInput::getInstance()->clean($params['template'], 'cmd') : 'system';
         if (!file_exists($directory . '/' . $template . '/' . $file)) {
             $template = 'system';
         }
         // Set variables
         $this->baseurl = JUri::base(true);
         $this->template = $template;
         $this->error = $this->_error;
         $this->debug = isset($params['debug']) ? $params['debug'] : false;
         $this->code = isset($params['code']) ? $params['code'] : $code;
         $this->message = isset($params['message']) ? $params['message'] : $message;
         // Load
         $data = $this->_loadTemplate($directory . '/' . $template, $file);
         parent::render();
         return $data;
     }
 }
开发者ID:woakes070048,项目名称:joomlatools-platform,代码行数:45,代码来源:error.php

示例3: validate

 /**
  * Axis must be provided for new variant group
  *
  * @param object     $variantGroup
  * @param Constraint $constraint
  */
 public function validate($variantGroup, Constraint $constraint)
 {
     /** @var GroupInterface */
     if ($variantGroup instanceof GroupInterface) {
         $isNew = $variantGroup->getId() === null;
         $isVariantGroup = $variantGroup->getType()->isVariant();
         $hasAxis = count($variantGroup->getAxisAttributes()) > 0;
         if ($isNew && $isVariantGroup && !$hasAxis) {
             $this->context->addViolation($constraint->expectedAxisMessage, array('%variant group%' => $variantGroup->getCode()));
         } elseif (!$isVariantGroup && $hasAxis) {
             $this->context->addViolation($constraint->unexpectedAxisMessage, array('%group%' => $variantGroup->getCode()));
         }
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:20,代码来源:VariantGroupAxisValidator.php

示例4: normalize

 /**
  * @param  object                                                $attribute
  * @param  null                                                  $format
  * @param  array                                                 $context
  * @return array|\Symfony\Component\Serializer\Normalizer\scalar
  */
 public function normalize($attribute, $format = null, array $context = [])
 {
     /**@var Attribute $attribute * */
     $normalizedAttribute = ['code' => null, 'type' => null, 'required' => null, 'labels' => null, 'parameters' => null];
     $availableLocales = [];
     $attributeAvailableLocales = $attribute->getAvailableLocales();
     if (!is_null($attributeAvailableLocales)) {
         foreach ($attribute->getAvailableLocales() as $availableLocale) {
             $availableLocales [] = $availableLocale;
         }
     }
     $allowed_extensions = [];
     foreach ($attribute->getAllowedExtensions() as $allowed_extension) {
         $allowed_extensions [] = $allowed_extension;
     }
     $normalizedAttribute['required'] = $attribute->isRequired();
     $normalizedAttribute['type'] = $attribute->getAttributeType();
     $normalizedAttribute['code'] = $attribute->getCode();
     $normalizedAttribute['parameters'] = ['scope' => $attribute->isScopable(), 'localizable' => $attribute->isLocalizable(), 'available_locales' => $availableLocales, 'max_file_size' => $attribute->getMaxFileSize(), 'allowed_extensions' => $allowed_extensions];
     if ($attribute->isLocalizable()) {
         foreach ($attribute->getTranslations() as $trans) {
             $normalizedAttribute['labels'][$trans->getLocale()] = $trans->getLabel();
         }
     } else {
         $normalizedAttribute['labels'][LANGUAGE_NONE] = $attribute->getLabel();
     }
     return $normalizedAttribute;
 }
开发者ID:calin-marian,项目名称:DrupalCommerceConnectorBundle,代码行数:34,代码来源:PimCatalogFileNormalizer.php

示例5: render

 /**
  * Render the document
  *
  * @param   boolean $cache  If true, cache the output
  * @param   array   $params Associative array of attributes
  *
  * @return  string   The rendered data
  *
  * @since   11.1
  */
 public function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (!isset($this->_error)) {
         return;
     }
     // Set the status header
     \JFactory::getApplication()->setHeader('status', $this->_error->getCode() . ' ' . str_replace("\n", ' ', $this->_error->getMessage()));
     $file = 'error.php';
     // Check template
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = isset($params['template']) ? \JFilterInput::getInstance()->clean($params['template'], 'cmd') : 'system';
     if (!file_exists($directory . '/' . $template . '/' . $file)) {
         $template = 'system';
     }
     // Set variables
     $this->baseurl = \JUri::base(true);
     $this->template = $template;
     $this->debug = isset($params['debug']) ? $params['debug'] : false;
     $this->error = $this->_error;
     $params['params'] = \JFactory::getApplication()->getTemplate(true)->params;
     // Load
     $params['file'] = 'error.php';
     $this->parse($params);
     $data = $this->_renderTemplate();
     parent::render();
     return $data;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:38,代码来源:ErrorDocument.php

示例6: query

 /**
  * Обвертка для функции _query
  *
  * @param  string  $queryText поисковый запрос (в оригинальном виде)
  * @param  integer $store     ИД текущего магазина
  * @param  object  $index     индекс по которому нужно провести поиск
  *
  * @return array масив ИД елементов, где ИД - ключ, релевантность значение
  */
 public function query($queryText, $store, $index)
 {
     $indexCode = $index->getCode();
     $primaryKey = $index->getPrimaryKey();
     $attributes = $index->getAttributes();
     if ($store) {
         $store = array($store);
     }
     return $this->_query($queryText, $store, $indexCode, $primaryKey, $attributes);
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:19,代码来源:Sphinx.php

示例7: render

 /**
  * Render the error page based on an exception.
  *
  * @param   object  $error  An Exception or Throwable (PHP 7+) object for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render($error)
 {
     $expectedClass = PHP_MAJOR_VERSION >= 7 ? 'Throwable' : 'Exception';
     $isException = $error instanceof $expectedClass;
     // In PHP 5, the $error object should be an instance of Exception; PHP 7 should be a Throwable implementation
     if ($isException) {
         try {
             $app = JFactory::getApplication();
             $document = JDocument::getInstance('error');
             $code = $error->getCode();
             if (!isset(JHttpResponse::$status_messages[$code])) {
                 $code = '500';
             }
             if (ini_get('display_errors')) {
                 $message = $error->getMessage();
             } else {
                 $message = JHttpResponse::$status_messages[$code];
             }
             if (!$document || PHP_SAPI == 'cli') {
                 // We're probably in an CLI environment
                 jexit($message);
             }
             // Get the current template from the application
             $template = $app->getTemplate();
             // Push the error object into the document
             $document->setError($error);
             if (ob_get_contents()) {
                 ob_end_clean();
             }
             $document->setTitle(JText::_('Error') . ': ' . $code);
             $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JFactory::getConfig()->get('debug')));
             // Do not allow cache
             $app->allowCache(false);
             // If nothing was rendered, just use the message from the Exception
             if (empty($data)) {
                 $data = $message;
             }
             $app->setBody($data);
             echo $app->toString();
             return;
         } catch (Exception $e) {
             // Pass the error down
         }
     }
     // This isn't an Exception, we can't handle it.
     if (!headers_sent()) {
         header('HTTP/1.1 500 Internal Server Error');
     }
     $message = 'Error displaying the error page';
     if ($isException) {
         $message .= ': ' . $e->getMessage() . ': ' . $message;
     }
     echo $message;
     jexit(1);
 }
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:64,代码来源:page.php

示例8: __construct

 /**
  * constructor
  *
  */
 public function __construct()
 {
     $console_config = $this->getConfigArray();
     $configArray = array();
     // cli view argument definition
     $configArray['view'] = array('short' => 'v', 'min' => 1, 'max' => 1, 'desc' => 'Set the view to execute.');
     $console_config = array_merge($configArray, $console_config);
     $this->args =& Console_Getargs::factory($console_config);
     if (PEAR::isError($this->args)) {
         $mes = '';
         if ($this->args->getCode() === CONSOLE_GETARGS_ERROR_USER) {
             $mes = Console_Getargs::getHelp($console_config, null, $this->args->getMessage()) . "\n\n";
         } else {
             if ($this->args->getCode() === CONSOLE_GETARGS_HELP) {
                 $mes = Console_Getargs::getHelp($console_config) . "\n\n";
             }
         }
         $this->printError($mes);
     }
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:24,代码来源:SmartCliView.php

示例9: generate

 /**
  * @param  object $admin
  * @return false | int
  */
 public function generate($admin, $bundle)
 {
     $admin_name = $this->getAdminNameFromAdminCode($admin->getCode());
     $file_path = sprintf('%s/Tests/%sAdminTest.php', $bundle->getPath(), $admin_name);
     dump($file_path);
     $form_builder = $admin->getFormBuilder();
     // var_dump($builder->get('disponibility')->getAttributes()['data_collector/passed_options']['choices']);
     //var_dump($form_builder->get('vehicle_model')->getForm()->getConfig()->getOption('callback'));
     // var_dump($admin->getFormFieldDescription('disponibility'));
     $namespace = $this->getNamespace($admin);
     return $this->renderFile('AdminTests.php.twig', $file_path, array('admin' => $admin, 'form_builder' => $form_builder, 'admin_name' => $admin_name, 'namespace' => $namespace));
 }
开发者ID:rccc,项目名称:sonata-admin-tests-generator,代码行数:16,代码来源:SonataAdminTestsGenerator.php

示例10: errorAction

 /**
 * 常量(启用命名空间后的常量名) 	说明
  	YAF_VERSION(Yaf\VERSION)  Yaf框架的三位版本信息
 		YAF_ENVIRON(Yaf\ENVIRON   Yaf的环境常量, 指明了要读取的配置的节, 默认的是product
    YAF_ERR_STARTUP_FAILED(Yaf\ERR\STARTUP_FAILED)  Yaf的错误代码常量, 表示启动失败, 值为512
    YAF_ERR_ROUTE_FAILED(Yaf\ERR\ROUTE_FAILED)  Yaf的错误代码常量, 表示路由失败, 值为513
    YAF_ERR_DISPATCH_FAILED(Yaf\ERR\DISPATCH_FAILED)  Yaf的错误代码常量, 表示分发失败, 值为514
    YAF_ERR_NOTFOUND_MODULE(Yaf\ERR\NOTFOUD\MODULE)   Yaf的错误代码常量, 表示找不到指定的模块, 值为515
    YAF_ERR_NOTFOUND_CONTROLLER(Yaf\ERR\NOTFOUD\CONTROLLER)   Yaf的错误代码常量, 表示找不到指定的Controller, 值为516
    YAF_ERR_NOTFOUND_ACTION(Yaf\ERR\NOTFOUD\ACTION)   Yaf的错误代码常量, 表示找不到指定的Action, 值为517
    YAF_ERR_NOTFOUND_VIEW(Yaf\ERR\NOTFOUD\VIEW)   Yaf的错误代码常量, 表示找不到指定的视图文件, 值为518
    YAF_ERR_CALL_FAILED(Yaf\ERR\CALL_FAILED)  Yaf的错误代码常量, 表示调用失败, 值为519
    YAF_ERR_AUTOLOAD_FAILED(Yaf\ERR\AUTOLOAD_FAILED)  Yaf的错误代码常量, 表示自动加载类失败, 值为520
    YAF_ERR_TYPE_ERROR(Yaf\ERR\TYPE_ERROR)  Yaf的错误代码常量, 表示关键逻辑的参数错误, 值为521
    $this->getRequest ()->getModuleName ();
    $this->getRequest ()->getControllerName ();
    $this->getRequest ()->getActionName ();
    $exception->getCode ();
    $exception->getMessage ();
 * @param object $exception
 */
 public function errorAction($exception)
 {
     error_reporting(E_ERROR);
     //定义错误信息
     switch ($exception->getCode()) {
         case YAF_ERR_STARTUP_FAILED:
             $message = Lang::goLang('YAF_ERR_STARTUP_FAILED');
             //512
             break;
         case YAF_ERR_ROUTE_FAILED:
             $message = Lang::goLang('YAF_ERR_ROUTE_FAILED');
             //513
             break;
         case YAF_ERR_DISPATCH_FAILED:
             $message = Lang::goLang('YAF_ERR_DISPATCH_FAILED');
             //514
             break;
         case YAF_ERR_NOTFOUND_MODULE:
             $message = Lang::goLang('YAF_ERR_NOTFOUND_MODULE');
             //515
             break;
         case YAF_ERR_NOTFOUND_CONTROLLER:
             $message = Lang::goLang('YAF_ERR_NOTFOUND_CONTROLLER');
             //516
             break;
         case YAF_ERR_NOTFOUND_ACTION:
             $message = Lang::goLang('YAF_ERR_NOTFOUND_ACTION');
             //517
             break;
         case YAF_ERR_NOTFOUND_VIEW:
             $message = Lang::goLang('YAF_ERR_NOTFOUND_VIEW');
             //518
             break;
         case YAF_ERR_CALL_FAILED:
             $message = Lang::goLang('YAF_ERR_CALL_FAILED');
             //519
             break;
         case YAF_ERR_AUTOLOAD_FAILED:
             $message = Lang::goLang('YAF_ERR_AUTOLOAD_FAILED');
             //520
             break;
         case YAF_ERR_TYPE_ERROR:
             $message = Lang::goLang('YAF_ERR_TYPE_ERROR');
             //521
             break;
         default:
             $message = $exception;
             break;
     }
     // var_dump($message);die;
     $this->getView()->assign("message", '找不到该页面404');
     $this->getView()->assign("url", BASEURL);
 }
开发者ID:JREAMLU,项目名称:timeline,代码行数:74,代码来源:Error.php

示例11: normalize

 /**
  * @param  object                                                $group
  * @param  null                                                  $format
  * @param  array                                                 $context
  * @return array|\Symfony\Component\Serializer\Normalizer\scalar
  */
 public function normalize($group, $format = null, array $context = [])
 {
     /**@var Group $group * */
     $normalizedGroup = ['code' => $group->getCode(), 'type' => $group->getType()->getCode()];
     foreach ($group->getTranslations() as $trans) {
         $normalizedGroup['labels'][$trans->getLocale()] = $trans->getLabel();
     }
     foreach ($group->getAttributes() as $attr) {
         $normalizedGroup['attributes'][] = $attr->getCode();
     }
     return $normalizedGroup;
 }
开发者ID:calin-marian,项目名称:DrupalCommerceConnectorBundle,代码行数:18,代码来源:GroupNormalizer.php

示例12: handleError

 /**
  * Handle an error
  *
  * @param   object  $error
  * @return  void
  */
 public static function handleError(&$error)
 {
     // Make sure the error is a 403 and we are in the frontend.
     if ($error->getCode() == 403 and App::isSite()) {
         // Redirect to the home page
         App::redirect('index.php', Lang::txt('PLG_SYSTEM_LOGOUT_REDIRECT'), null, true, false);
     } else {
         // Render the error page.
         $renderer = new \Hubzero\Error\Renderer\Page(App::get('document'), App::get('template')->template, App::get('config')->get('debug'));
         $renderer->render($error);
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:18,代码来源:logout.php

示例13: getInfoExcept

 /**
  * Gets Information (message, code, file, line, trace) of an Exception.
  *
  * @param object $oE Exception object.
  * @return string
  */
 public static function getInfoExcept($oE)
 {
     $sDebug = $oE->getMessage();
     $sDebug .= '<br />';
     $sDebug = $oE->getCode();
     $sDebug .= '<br />';
     $sDebug = $oE->getFile();
     $sDebug .= '<br />';
     $sDebug = $oE->getLine();
     $sDebug .= '<br />';
     $sDebug .= $oE->getTraceAsString();
     return $sDebug;
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:19,代码来源:Debug.class.php

示例14: XsltProcessor

 /**
  * Error...
  *
  * @param object $e error object
  *
  * @return null
  */
 function Nexista_builderError($e)
 {
     if ($e->getCode() == NX_ERROR_FATAL || $e->getCode() == NX_ERROR_WARNING) {
         $use_xslt_cache = 'yes';
         if ($use_xslt_cache != 'yes' || !class_exists('xsltCache')) {
             $exceptionXsl = new XsltProcessor();
         } else {
             $exceptionXsl = new xsltCache();
         }
         $xsl = new DomDocument();
         $my_xsl_file = NX_PATH_BASE . 'extensions/dev_buffer/s/xsl/exception.xsl';
         if (file_exists($my_xsl_file)) {
             $xsl->load($my_xsl_file);
             $exceptionXsl->importStyleSheet($xsl);
             $xml = new DomDocument();
             $xml->loadXML($e->outputXml());
             $exceptionXsl->setParameter('', 'link_prefix', dirname($_SERVER['SCRIPT_NAME']) . '/index.php?nid=');
             $result = $exceptionXsl->transformToXML($xml);
             echo $result;
         }
     }
 }
开发者ID:savonix,项目名称:nexista,代码行数:29,代码来源:dev_buffer.php

示例15: writeLog

 /**
  *  Метод для записи логов
  *  @param object $e Объект класса Exception
  *  @return bool Вернет истину если файл запишется
  */
 public function writeLog($e)
 {
     $datetime = date('d/m/y H:i:s');
     $msg = date('d/m/y H:i:s') . '||';
     $msg .= 'Код: ' . $e->getCode() . '||';
     $msg .= 'Сообщение: ' . $e->getMessage() . '||';
     $msg .= 'Линия: ' . $e->getLine() . '||';
     $msg .= 'Файл: ' . $e->getFile() . "\n";
     if (!file_put_contents(Config::LOGS, $msg, FILE_APPEND | LOCK_EX)) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:echmaster,项目名称:bit,代码行数:19,代码来源:Logger.php


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