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


PHP Debug::toss方法代码示例

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


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

示例1: __callStatic

 static function __callStatic($name, $arguments)
 {
     if (!method_exists(__CLASS__, $name)) {
         Debug::toss('DbBatch method not found: ' . $name);
     }
     $class = __CLASS__;
     $that = new $class();
     return call_user_func_array(array($that, $name), $arguments);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:9,代码来源:DbBatch.php

示例2: req

 function req($className)
 {
     $result = $this->load($className);
     $lastAutoloader = array_slice(spl_autoload_functions(), -1)[0];
     //this is the last autoload and it has failed
     if (!$result['found'] && is_a($lastAutoloader, 'Autoload')) {
         $error = 'Attempt to autoload class "' . $className . '" has failed.  Tested folders: ' . "\n" . implode("\n", array_keys($result['searched']));
         Debug::toss($error, __CLASS__ . 'Exception');
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:10,代码来源:Autoload.php

示例3: __call

 function __call($name, $arguments)
 {
     if (!method_exists($this, $name)) {
         $name = substr($name, 1);
         if (!method_exists(__CLASS__, $name)) {
             \Debug::toss('Bad Form class method');
         }
         $formerValueBehavior = $this->valueBehavior;
         $this->valueBehavior = array_shift($arguments);
         $return = call_user_func_array(array($this, $name), $arguments);
         $this->valueBehavior = $formerValueBehavior;
         return $return;
     }
     return call_user_func_array(array($this, $name), $arguments);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:15,代码来源:Form.php

示例4: loadXml

 static function loadXml($xml, $nsPrefix = 'd')
 {
     $dom = new DOMDocument();
     @$dom->loadXML($xml);
     $xpath = new DomXPath($dom);
     $rootNamespace = $dom->lookupNamespaceUri($dom->namespaceURI);
     if ($rootNamespace) {
         if ($dom->documentElement->getAttribute('xmlns:d')) {
             Debug::toss('Namespace prefix "' . $nsPrefix . '" taken');
         }
         $xpath->registerNamespace($nsPrefix, $rootNamespace);
         $nsPrefix .= ':';
     } else {
         $nsPrefix = '';
     }
     return array($dom, $xpath, $nsPrefix);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:17,代码来源:DOMTools.php

示例5: req

 function req($name, $timeout = 0)
 {
     if (!$this->on($name, $timeout)) {
         Debug::toss('Failed to acquire lock "' . $name . '"', __CLASS__ . 'Exception');
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:6,代码来源:Lock.php

示例6: validateCsrfToken

 protected function validateCsrfToken()
 {
     $csrfToken = $_SESSION['csrfToken'];
     unset($_SESSION['csrfToken']);
     if (!$this->control->in['csrfToken']) {
         \Debug::toss('Missing CSRF token', 'InputException');
     } elseif ($this->control->in['csrfToken'] != $csrfToken) {
         \Debug::toss('CSRF token mismatch', 'InputException');
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:10,代码来源:Common.php

示例7: findLink

 protected function findLink($table, $referencedTable, $referenceColumn = null)
 {
     foreach ($this->tables[$table]['links'] as $k => $v) {
         if ($v['ft'] == $referencedTable) {
             if (!$referenceColumn || $referenceColumn == $v['dc']) {
                 return $k;
             }
         }
     }
     Debug::toss('DbModel failed to find link', var_export(func_get_args(), 1));
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:11,代码来源:DbModel.php

示例8: __call

 function __call($fnName, $args)
 {
     if (method_exists($this, $fnName)) {
         return call_user_func_array(array($this, $fnName), $args);
     } elseif (method_exists($this->under, $fnName)) {
         return call_user_func_array(array($this->under, $fnName), $args);
     } elseif (method_exists($this->under, '__call')) {
         //under may have it's own __call handling
         return call_user_func_array(array($this->under, $fnName), $args);
     }
     Debug::toss(__CLASS__ . ' Method not found: ' . $fnName);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:12,代码来源:CommonTraits.php

示例9: sendFile

 static function sendFile($path, $saveAs = null, $exit = true)
 {
     //Might potentially remove ".." from path, but it has already been removed by the time the request gets here by server or browser.  Still removing for precaution
     $path = Files::removeRelative($path);
     if (is_file($path)) {
         $mime = Files::mime($path);
         header('Content-Type: ' . $mime);
         if ($saveAs) {
             header('Content-Description: File Transfer');
             if (strlen($saveAs) > 1) {
                 $fileName = $saveAs;
             } else {
                 $fileName = array_pop(explode('/', $path));
             }
             header('Content-Disposition: attachment; filename="' . self::escapeFilename($fileName) . '"');
         }
         echo file_get_contents($path);
     } elseif ($_ENV['resourceNotFound']) {
         Config::loadUserFiles($_ENV['resourceNotFound'], 'control');
     } else {
         Debug::toss('Request handler encountered unresolvable file.  Searched at ' . $path);
     }
     if ($exit) {
         exit;
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:26,代码来源:View.php

示例10: delete

 /**
 @param	table	table to replace on
 @param	where	see self::where() function
 @return	row count
 @note as a precaution, to delete all must use $where = '1 = 1'
 */
 protected function delete($table, $where)
 {
     if (!$where) {
         Debug::toss('Unqualified delete is too risky.  Use 1=1 to verify');
     }
     return $this->query('DELETE FROM ' . $this->quoteIdentity($table) . $this->where($where))->rowCount();
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:13,代码来源:Db.php

示例11: part

 /**
 @param	rules	string or array	
 	Rules can be an array of rules, or a string separated by "," for each rule.  
 	Each rule can be a string or an array.  
 	As a string, the rule should be in one of the following forms:
 			"f:name|param1;param2" indicates InputFilter method
 			"v:name|param1;param2" indicates InputValidate function
 			"g:name|param1;param2" indicates global scoped function
 			"class:name|param1,param2,param3" indicates static method "name: of class "class" 
 			"l:name|param1,param2,param3" Local tool method
 			"name" replaced by Field fieldType of the same name
 	As an array, the rule function part (type:method) is the first element, and the parameters to the function part are the following elements.  Useful if function arguments contain commas or semicolons.  Ex:
 		array('type:method','arg1','arg2','arg3')
 	
 	The "type:method" part can be prefixed with "!" to indicate there should be a break on error, and no more rules for that field should be applied
 	The "type:method" part can be prefixed with "!!" to indicate there should be a break on error and no more rules for any field should be applied
 	
 	If array, first part of rule is taken as string with the behavior above without parameters and the second part is taken as the parameters; useful for parameters that include commas or semicolons or which aren't strings
 	
 	Examples for rules:
 		1: 'v:email|bob.com,customClass:method|param1;param2',
 		2: array('v:email|bob.com','customClass:method|param1;param2'),
 		3: array(array('v:email','bob.com'),array('customClass:method','param1','param2')),
 */
 function applyFilterValidateRules($field, $rules, $errorOptions)
 {
     $originalRules = $rules;
     $rules = Arrays::stringArray($rules);
     for ($i = 0; $i < count($rules); $i++) {
         $rule = $rules[$i];
         $params = array(&$this->in[$field]);
         if (is_array($rule)) {
             $callback = array_shift($rule);
             $params2 =& $rule;
         } else {
             list($callback, $params2) = explode('|', $rule);
             if ($params2) {
                 $params2 = explode(';', $params2);
             }
         }
         ///merge field value param with the user provided params
         if ($params2) {
             Arrays::mergeInto($params, $params2);
         }
         //used in combination with !, like ?! for fields that, if not empty, should be validated, otherwise, ignored.
         $ignoreError = false;
         if (substr($callback, 0, 1) == '?') {
             $callback = substr($callback, 1);
             $ignoreError = true;
         }
         if (substr($callback, 0, 2) == '!!') {
             $callback = substr($callback, 2);
             $superBreak = true;
         }
         if (substr($callback, 0, 1) == '!') {
             $callback = substr($callback, 1);
             $break = true;
         }
         list($type, $method) = explode(':', $callback, 2);
         if (!$method) {
             $method = $type;
             $type = '';
         }
         if (!$method) {
             Debug::quit('Failed to provide method for input handler on field: ' . $field, 'Rules:', $rules);
         }
         try {
             switch ($type) {
                 case 'f':
                     call_user_func_array(array('InputFilter', $method), $params);
                     break;
                 case 'v':
                     call_user_func_array(array('InputValidate', $method), $params);
                     break;
                 case 'l':
                     call_user_func_array(array($this->lt, $method), $params);
                     break;
                 case 'g':
                     call_user_func_array($method, $params);
                     break;
                 case '':
                     if ($this->inputRuleAliases === null) {
                         $this->inputRuleAliases = \control\Field::$ruleAliases;
                     }
                     //get new named rules and parse
                     if (!$this->inputRuleAliases[$method]) {
                         Debug::toss('Unknown input rule alias on field ' . $field . ' Rule:' . $rule);
                     }
                     $newRules = Arrays::stringArray($this->inputRuleAliases[$method]);
                     if ($i + 1 < count($rules)) {
                         ///there are rules after this alias, so combine alias with those existing after
                         $newRules = array_merge($newRules, array_slice($rules, $i + 1));
                     }
                     $rules = $newRules;
                     $i = -1;
                     break;
                 default:
                     call_user_func_array(array($type, $method), $params);
                     break;
             }
//.........这里部分代码省略.........
开发者ID:jstacoder,项目名称:brushfire,代码行数:101,代码来源:Control.php

示例12: htmlTagContextIntegrityCallback

 static function htmlTagContextIntegrityCallback($match)
 {
     preg_match('@^[a-z]+@i', $match[2], $tagMatch);
     $tagName = $tagMatch[0];
     if ($match[1] == '<') {
         //don't count self contained tags
         if (substr($match[2], -1) != '/') {
             self::$tagHierarchy[] = $tagName;
         }
     } else {
         $lastTagName = array_pop(self::$tagHierarchy);
         if ($tagName != $lastTagName) {
             Debug::toss(self::$errorMessages['noTagIntegrity'], 'InputException');
         }
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:16,代码来源:InputValidate.php

示例13: reqOnce

 /**
 @param	file	file path
 @param	globalize	list of strings representing variables to globalize for the included file
 @param	vars	variables to extract for use by the file
 @param	extract	variables to extract from the included file to be returned
 @return	true or extracted varaibles if file successfully included, else false
 */
 private static function reqOnce($_file, $_globalize = null, $_vars = null, $_extract = null)
 {
     if (is_file($_file)) {
         self::logIncluded(true);
         if ($_globalize) {
             foreach ($_globalize as $_global) {
                 global ${$_global};
             }
         }
         if ($_vars) {
             extract($_vars, EXTR_SKIP);
             #don't overwrite existing
         }
         include_once $_file;
         if ($_extract) {
             foreach ($_extract as $_var) {
                 $_return[$_var] = ${$_var};
             }
             return $_return;
         }
         return true;
     }
     self::logIncluded(false);
     Debug::toss('Could not include file "' . $_file . '"');
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:32,代码来源:Files.php

示例14: load

 function load()
 {
     $this->under = $this->cacher = new Memcached();
     if (!is_array(current($this->connectionInfo))) {
         $this->connectionInfo = array($this->connectionInfo);
     }
     foreach ($this->connectionInfo as $v) {
         if (!$this->cacher->addserver($v[0], $v[1], $v[2])) {
             Debug::toss('Failed to add cacher "' . $name . '"', __CLASS__ . 'Exception');
         }
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:12,代码来源:Cache.php

示例15: fork

 static function fork($callable)
 {
     $pid = pcntl_fork();
     if ($pid == -1) {
         Debug::toss('could not fork');
     } elseif ($pid) {
         // we are the parent
         return;
     } else {
         call_user_func_array($callable, array_slice(func_get_args(), 1));
         exit;
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:13,代码来源:Tool.php


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