• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP throwError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ofType

function ofType($type, $val)
{
    if ($val instanceof $type) {
        return $val;
    }
    throwError("Not of type '{$type}'");
}
开发者ID:hvasoares,项目名称:validations,代码行数:7,代码来源:reflection.php


示例2: addDataRow

 public function addDataRow($values, $name = false)
 {
     /**
      *	Adds a data row to the existing graph
      *
      *	@param $values: An array of values
      *	@param $name (optional): The name of the data row
      *
      *	@return: TRUE if adding the data row suceeded, FALSE if not
      */
     if (!is_array($values)) {
         throwError('First argument should be an array', __METHOD__);
         return false;
     }
     if ($name !== false) {
         $name = (string) $name;
     } else {
         $name = 'Data row ' . ($this->nrOfDataRows + 1);
     }
     $this->dataRow[] = $values;
     $this->dataRowNames[] = $name;
     $this->nrOfDataRows++;
     $max = max($values);
     $min = min($values);
     $this->calculateGraduation($min, $max);
     $this->averages[] = false;
     $this->averagesNames[] = false;
     $this->movingAverages[] = false;
     $this->movingAveragesNames[] = false;
     $this->hyperlinks[] = false;
     // re-calculate rect width
     $this->calculateRectSpecs();
     return true;
 }
开发者ID:BerlusGmbH,项目名称:Berlussimo,代码行数:34,代码来源:BarGraph.php


示例3: makeZip

 /**
  * 
  * make zip archive
  * if exists additional paths, add additional items to the zip
  */
 public function makeZip($srcPath, $zipFilepath, $additionPaths = array())
 {
     if (!is_dir($srcPath)) {
         throwError("The path: '{$srcPath}' don't exists, can't zip");
     }
     $this->zip = new ZipArchive();
     $success = $this->zip->open($zipFilepath, ZipArchive::CREATE);
     if ($success == false) {
         throwError("Can't create zip file: {$zipFilepath}");
     }
     $this->addItem($srcPath, $srcPath);
     if (gettype($additionPaths) != "array") {
         throwError("Wrong additional paths variable.");
     }
     //add additional paths
     if (!empty($additionPaths)) {
         foreach ($additionPaths as $path) {
             if (!is_dir($path)) {
                 throwError("Path: {$path} not found, can't zip");
             }
             $this->addItem($path, $path);
         }
     }
     $this->zip->close();
 }
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:30,代码来源:zip.class.php


示例4: addStep

 /**
  * Adds a new {@link WizardStep} to this wizard.
  * @param string $name A short id/name for this step.
  * @param ref object $step
  * @access public
  * @return ref object
  */
 function addStep($name, $step)
 {
     if (count($this->getSteps())) {
         throwError(new Error("SingleStepWizards can only have one step. Cannot add '" . $name . "' step.", "Wizard"));
     }
     return parent::addStep($name, $step);
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:14,代码来源:SingleStepWizard.class.php


示例5: isArrayAndReturnValue

function isArrayAndReturnValue($val, $index)
{
    if (isArray($val) && array_key_exists($index, $val)) {
        return $val[$index];
    }
    throwError("The array doesn't has {$index}");
}
开发者ID:hvasoares,项目名称:validations,代码行数:7,代码来源:arrays.php


示例6: output

 /**
  * Outputs the content of the current template with $variables containing
  * the variable output.
  * @param optional mixed $variables,... Either an associative array or a {@link FieldSet} containing
  * a number of [key]=>content pairs.
  * @access public
  * @return void
  **/
 function output()
 {
     // go through each argument, check if its good and set all the variables.
     for ($i = 0; $i < func_num_args(); $i++) {
         $__v = func_get_arg($i);
         if (is_array($__v)) {
             // ok, register them all as local variables
             foreach (array_keys($__v) as $__k) {
                 ${$__k} = $__v[$__k];
             }
         } else {
             if ($__v instanceof FieldSet) {
                 $__keys = $__v->getKeys();
                 foreach ($__keys as $__k) {
                     ${$__k} = $__v->get($__k);
                 }
             } else {
                 throwError(new Error("Template::output() - could not output: variables passed to method do not seem to be an associative array or a FieldSet."));
                 return false;
             }
         }
     }
     // for
     // otherwise, let's continue and output the file.
     include $this->_fullPath;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:34,代码来源:Template.class.php


示例7: getTargetId

 /**
  * Answers the target Id for all NavBlocks in the menu
  * 
  * @return string the target id
  * @access public
  * @since 4/12/06
  */
 function getTargetId()
 {
     if ($this->_element->hasAttribute('target_id')) {
         return $this->_element->getAttribute('target_id');
     }
     throwError(new Error("No target_id available " . $this->_element->toString(true), "XmlSiteComponents"));
 }
开发者ID:adamfranco,项目名称:segue,代码行数:14,代码来源:XmlMenuOrganizerSiteComponent.class.php


示例8: HarmoniTimespan

 /**
  * The constructor.
  * 
  * @param long $_start the start of the time span
  * @param long $_end the end of the time span
  * 
  * @access public
  * @return void
  */
 function HarmoniTimespan($start, $end)
 {
     if ($start > $end) {
         throwError(new Error("The end of a Timespan cannot come before the end", "HarmoniTimespan", true));
     }
     $this->_start = $start;
     $this->_end = $end;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:17,代码来源:HarmoniTimespan.class.php


示例9: executeAction

 /**
  * Executes the specified action in the specified module, using the Harmoni object as a base.
  * @param string $module The module in which to execute.
  * @param string $action The specific action to execute.
  * @access public
  * @return ref mixed A {@link Layout} or TRUE/FALSE
  */
 function executeAction($module, $action)
 {
     $fullPath = $this->_mkFullPath($module, $action);
     if (!$this->actionExists($module, $action)) {
         throwError(new Error("FlatFileActionSource::executeAction({$module}, {$action}) - could not proceed because the file to include does not exist!", "ActionHandler", true));
     }
     $result = (include $fullPath);
     return $result;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:16,代码来源:FlatFileActionSource.class.php


示例10: suffixForPower

 /**
  * Answer the string suffix for the desired muliple of 2^10 bytes
  * i.e. 0 -> B, 10 -> kB, 20 -> MB, 30 -> GB, etc.
  * 
  * @param integer $power A multiple of 10; Range, 0-80
  * @return string
  * @access public
  * @since 10/11/05
  * @static
  */
 static function suffixForPower($power)
 {
     $multiple = intval($power / 10);
     if ($multiple < 0 || $multiple > 8) {
         throwError(new Error("Invalid power, {$power}. Valid values are multiples of ten, 0-80.", "ByteSize", true));
     }
     $suffixes = array("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
     return $suffixes[$multiple];
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:19,代码来源:ByteSize.class.php


示例11: TemplateFactory

 function TemplateFactory($searchPath1)
 {
     if (!func_num_args()) {
         throwError(new Error("TemplateFactory - you must specify at least one search path.", "TemplateFactory", true));
     }
     foreach (func_get_args() as $arg) {
         $this->_paths[] = $arg;
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:9,代码来源:TemplateFactory.class.php


示例12: __autoload

function __autoload($classname)
{
    $clbase = strtolower($classname) . '.php';
    $classfile = $_SERVER['DOCUMENT_ROOT'] . '/class/' . $clbase;
    if (file_exists($classfile)) {
        require $classfile;
    } else {
        throwError('missing class file');
    }
}
开发者ID:naum,项目名称:tachatachatacha,代码行数:10,代码来源:horatio.php


示例13: createTokensObject

 /**
  * Create a Tokens Object
  * 
  * @return object Tokens
  * @access public
  * @since 3/1/05
  */
 function createTokensObject()
 {
     $tokensClass = $this->_configuration->getProperty('tokens_class');
     $newTokens = new $tokensClass($this->_configuration);
     $validatorRule = ExtendsValidatorRule::getRule('LDAPAuthNTokens');
     if ($validatorRule->check($newTokens)) {
         return $newTokens;
     } else {
         throwError(new Error("Configuration Error: tokens_class, '" . $tokensClass . "' does not extend UsernamePasswordAuthNTokens.", "LDAPAuthNMethod", true));
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:18,代码来源:LDAPAuthNMethod.class.php


示例14: level

 /**
  * Sets the DebugHandler service's output level to $level. If not specified will
  * return the current output level.
  * @param optional integer $level
  * @static
  * @access public
  * @return integer The current debug output level.
  **/
 static function level($level = null)
 {
     if (!Services::serviceAvailable("Debug")) {
         throwError(new Error("Debug::level({$level}) called but Debug service isn't available.", "debug wrapper", false));
         return;
     }
     $debugHandler = Services::getService("Debug");
     if (is_int($level)) {
         $debugHandler->setOutputLevel($level);
     }
     return $debugHandler->getOutputLevel();
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:20,代码来源:debug.class.php


示例15: printTime

 function printTime()
 {
     if (!isset($this->_start) || !isset($this->_end)) {
         $err = "Must call start() and end() first.";
         throwError(new Error($err, "Timer", true));
     }
     list($sm, $ss) = explode(" ", $this->_start);
     list($em, $es) = explode(" ", $this->_end);
     $s = $ss + $sm;
     $e = $es + $em;
     return $e - $s;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:12,代码来源:Timer.class.php


示例16: DateVersionConstraint

 function DateVersionConstraint($relativeDateString)
 {
     $now = time();
     $relative = strtotime($relativeDateString, $now);
     if ($relative === -1) {
         throwError(new Error("DateVersionConstraint: the passed relative date string, '{$relativeDateString}', does not appear to be valid.", "DateVersionConstraint", true));
     }
     if ($relativeDateString >= $now) {
         throwError(new Error("DateVersionConstraint: the specified relative date must be in the PAST.", "DateVersionConstraint", true));
     }
     $this->_cutoffDate = $relative;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:12,代码来源:DateVersionConstraint.class.php


示例17: nameOfDay

 /**
  * Return the name of the day at index.
  * 
  * @param integer $anInteger
  * @return string
  * @access public
  * @since 5/4/05
  */
 static function nameOfDay($anInteger)
 {
     $names = ChronologyConstants::DayNames();
     if ($names[$anInteger]) {
         return $names[$anInteger];
     }
     $errorString = $anInteger . " is not a valid day index.";
     if (function_exists('throwError')) {
         throwError(new Error($errorString));
     } else {
         die($errorString);
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:21,代码来源:Week.class.php


示例18: set

 /**
  * The set method sets the value for a field while checking constrictions.
  * @param string $field The field to set.
  * @param mixed $val The value to set $field to.
  * @access public
  * @return boolean True if setting $field succeeds. 
  **/
 function set($field, $val)
 {
     // first check if this is a valid field.
     if (!in_array($field, $this->_ruleSet->getKeys())) {
         // no good
         throwError(new Error(get_class($this) . " - can not set key '{$field}' because it is not a valid key!", "UserDataContainer", true));
         return false;
     }
     if ($this->_ruleSet->validate($field, $val)) {
         $this->_fieldSet->set($field, $val);
         $this->_setFields[$field] = true;
         return true;
     }
     return false;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:22,代码来源:UserDataContainer.abstract.php


示例19: HTMLcolor

 /**
  * The constructor.
  * @param string $color The HTML color.
  * @access public
  * @return void 
  **/
 function HTMLcolor($color)
 {
     $color = preg_replace("/^\\#/", "", $color);
     if (strlen($color) == 3) {
         $color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
     }
     if (strlen($color) != 6) {
         throwError(new Error("HTMLcolor - can not create class for color '{$color}': it is not a valid HTML color.", "HTMLcolor", false));
     }
     // convert each part into its decimal equivaleng.
     $rgb = explode(" ", chunk_split($color, 2, " "));
     $this->_red = (int) hexdec($rgb[0]);
     $this->_green = (int) hexdec($rgb[1]);
     $this->_blue = (int) hexdec($rgb[2]);
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:21,代码来源:HTMLcolor.class.php


示例20: returnSearchString

 function returnSearchString()
 {
     $mgr = Services::getService("SchemaManager");
     $typeMgr = Services::getService("DataTypeManager");
     $def = $mgr->getSchemaByID($this->_schemaID);
     $def->load();
     $fieldID = $def->getFieldIDFromLabel($this->_label);
     $field = $def->getField($fieldID);
     // first check if the $value we have is of the correct data type
     $extendsRule = ExtendsValidatorRule::getRule("HarmoniIterator");
     if (!$typeMgr->isObjectOfDataType($this->_value, $field->getType()) && !$extendsRule->check($this->_value)) {
         throwError(new Error("Cannot take a '" . get_class($this->_value) . "' object as search criteria\n\t\t\tfor field '{$this->_label}'; a '" . $field->getType() . "' is required.", "FieldValueSearch", true));
     }
     $class = $typeMgr->storablePrimitiveClassForType($field->getType());
     eval('$string = ' . $class . '::makeSearchString($this->_value, $this->_comparison);');
     return "(dm_record_field.fk_schema_field='" . addslashes($fieldID) . "' AND " . $string . " AND dm_record_field.active=1)";
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:17,代码来源:FieldValueSearch.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP throwException函数代码示例发布时间:2022-05-23
下一篇:
PHP throw404函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap