本文整理汇总了PHP中object::error方法的典型用法代码示例。如果您正苦于以下问题:PHP object::error方法的具体用法?PHP object::error怎么用?PHP object::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_backup_with_errors
public function test_backup_with_errors()
{
$this->assertTrue($this->backup->backup());
$this->assertFileExists($this->backup->get_backup_filepath());
$this->backup->error(get_class($this->backup), 'foobar');
$this->assertFalse($this->backup->verify_backup());
}
示例2: request
/**
* {@inheritdoc}
*/
public function request($uri, $method = 'GET', $parameters = [], $headers = [])
{
$this->requestArguments = ['uri' => $uri, 'method' => $method, 'parameters' => $parameters, 'headers' => $headers];
$this->requestHeader = array_merge($this->requestHeader, $headers);
$response = null;
try {
if ('GET' == $method) {
$response = $this->client->get($uri, ['query' => $parameters, 'headers' => $this->requestHeader]);
}
if ('POST' == $method) {
$response = $this->client->post($uri, ['form_params' => $parameters, 'headers' => $this->requestHeader]);
}
} catch (\Exception $e) {
$response = $e->getResponse();
$this->responseClientError = $e->getMessage();
}
if (!$this->responseClientError) {
$this->responseBody = $response->getBody();
$this->responseHttpCode = $response->getStatusCode();
$this->responseHeader = $response->getHeaders();
}
if ($this->logger) {
$this->logger->debug("HttpClient\\Guzzle::request( {$uri}, {$method} ), response:", $this->getResponse());
if ($this->responseClientError) {
$this->logger->error("HttpClient\\Guzzle::request( {$uri}, {$method} ), GuzzleHttp error: ", [$this->responseClientError]);
}
}
return $this->responseBody;
}
示例3:
/**
* 处理错误信息
*
* @access private
* @param string $query_item SQL查询项
* @return boolean 成功返回true,失败返回false。
*/
function handle_error($query_item)
{
$mysql_error = 'ERROR NO: ' . $this->db->errno()
. "\r\nERROR MSG: " . $this->db->error();
$error_str = "SQL Error:\r\n " . $mysql_error
. "\r\n\r\n"
. "Query String:\r\n ". $query_item
. "\r\n\r\n"
. "File Path:\r\n ". $this->current_file
. "\r\n\r\n\r\n\r\n";
/* 过滤一些错误 */
if (!in_array($this->db->errno(), $this->ignored_errors))
{
$this->error = $error_str;
}
if ($this->log_path)
{
$f = @fopen($this->log_path, 'ab+');
if (!$f)
{
return false;
}
if (!@fwrite($f, $error_str))
{
return false;
}
}
return true;
}
示例4: run
/**
* Запуск задачи на выполнение
*
* @param bool $force
* @throws Exception
* @return mixed
*/
public function run($force = false)
{
if (!$this->_Client->runTasks()) {
throw new Exception('Не удалось запустить выполнение задач: ' . $this->_Client->error());
}
return $this->_config['background'] || $force ? true : $this->_out;
}
示例5: request
/**
* {@inheritdoc}
*/
public function request($uri, $method = 'GET', $parameters = [], $headers = [])
{
$this->requestArguments = ['uri' => $uri, 'method' => $method, 'parameters' => $parameters, 'headers' => $headers];
$curl = curl_init();
if ('GET' == $method) {
unset($this->curlOptions[CURLOPT_POST]);
unset($this->curlOptions[CURLOPT_POSTFIELDS]);
$uri = $uri . (strpos($uri, '?') ? '&' : '?') . http_build_query($parameters);
}
if ('POST' == $method) {
$this->curlOptions[CURLOPT_POST] = true;
$this->curlOptions[CURLOPT_POSTFIELDS] = $parameters;
}
$this->requestHeader = array_merge($this->requestHeader, $headers);
$this->requestArguments['headers'] = $this->requestHeader;
$this->curlOptions[CURLOPT_URL] = $uri;
$this->curlOptions[CURLOPT_HTTPHEADER] = $this->prepareRequestHeaders();
$this->curlOptions[CURLOPT_HEADERFUNCTION] = [$this, 'fetchResponseHeader'];
foreach ($this->curlOptions as $opt => $value) {
curl_setopt($curl, $opt, $value);
}
$response = curl_exec($curl);
$this->responseBody = $response;
$this->responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$this->responseClientError = curl_error($curl);
$this->responseClientInfo = curl_getinfo($curl);
if ($this->logger) {
$this->logger->debug("HttpClient\\Curl::request( {$uri}, {$method} ), response:", $this->getResponse());
if (false === $response) {
$this->logger->error("HttpClient\\Curl::request( {$uri}, {$method} ), curl_exec error: ", [$this->responseClientError]);
}
}
curl_close($curl);
return $this->responseBody;
}
示例6: setPageno
/**
* Set pageno
*
* @param int $pageno Pagenumber to use
*/
function setPageno($pageno)
{
$pageno = (int) $pageno - 1;
if ($pageno < 0 || $pageno >= $this->getPageCount()) {
$this->fpdi->error('Pagenumber is wrong!');
}
$this->pageno = $pageno;
}
示例7: testFormErrorWithRecordAndSpecificKey
public function testFormErrorWithRecordAndSpecificKey()
{
$record = new Record();
$record->errors(array('name' => array('Please enter a name')));
$this->form->create($record);
$result = $this->form->error('name', 0);
$this->assertTags($result, array('div' => array('class' => 'error'), 'Please enter a name', '/div'));
}
示例8: validate
/**
* validates the data passed to the setValue method
*
* @access private
* @return boolean, status of the validation
*/
private function validate($name, $value, $rules)
{
try {
$this->_validator->reset()->setName($name)->setValue($value)->setRules($rules)->validate();
} catch (Exception $e) {
echo $e->getMessage();
}
return $this->_validator->error();
}
示例9: handler
/**
* Handle error/s for specific error codes
*
* @param object $f3 FatFree instance
* @return mixed Custom error/Default FatFree error
*/
public static function handler($f3)
{
$error = $f3->get('ERROR');
switch ($error['code']) {
default:
$f3->mset(array('ONERROR' => null, 'ERROR' => null));
$f3->error($error['code'], $error['text'], $error['trace']);
}
}
示例10: remove
/**
* Remove a message from the queue
*
* @param string $mid
* @return mixed
*/
public function remove($mid)
{
$ret = $this->implement->delete($mid);
if ($ret === false || $this->implement->error()) {
$this->error = $this->implement->error();
return false;
}
return true;
}
示例11: rebuildContentStream
/**
* Rebuild content-streams
* only non-compressed streams and /FlateDecode are ready!
*
* @param array $obj
* @return string
*/
function rebuildContentStream($obj) {
$filters = array();
if (isset($obj[1][1]['/Filter'])) {
$_filter = $obj[1][1]['/Filter'];
if ($_filter[0] == PDF_TYPE_TOKEN) {
$filters[] = $_filter;
} else if ($_filter[0] == PDF_TYPE_ARRAY) {
$filters = $_filter[1];
}
}
$stream = $obj[2][1];
foreach ($filters AS $_filter) {
switch ($_filter[1]) {
case "/FlateDecode":
if (function_exists('gzuncompress')) {
$stream = @gzuncompress($stream);
} else {
$this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1]));
}
if ($stream === false) {
$this->fpdi->error("Error while decompressing string.");
}
break;
case "/LZWDecode":
@include_once("decoders/lzw.php");
if (class_exists("LZWDecode")) {
$lzwdec = new LZWDecode($this->fpdi);
$stream = $lzwdec->decode($stream);
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case "/ASCII85Decode":
@include_once("decoders/ascii85.php");
if (class_exists("ASCII85Decode")) {
$ascii85 = new \ASCII85Decode($this->fpdi);
$stream = $ascii85->decode(trim($stream));
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case null:
$stream = $stream;
break;
default:
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
}
return $stream;
}
示例12: beforeRoute
/**
* Creates a new DB instance and clean some data.
*
* @param object $f3 A f3 instance.
*/
function beforeRoute($f3)
{
$base = 'data/' . $f3->get('PARAMS.game') . '.sqlite';
$this->playername = $f3->get('sanidad')->sanitize($f3->get('PARAMS.playername'));
if (file_exists($base)) {
$this->db = new DB\SQL('sqlite:' . $base);
} else {
$f3->error(500);
}
}
示例13: ftell
/**
* Resolve an object
*
* @param object $c pdf_context
* @param array $obj_spec The object-data
* @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para
*/
function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true)
{
// Exit if we get invalid data
if (!is_array($obj_spec)) {
return false;
}
if ($obj_spec[0] == PDF_TYPE_OBJREF) {
// This is a reference, resolve it
if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) {
// Save current file position
// This is needed if you want to resolve
// references while you're reading another object
// (e.g.: if you need to determine the length
// of a stream)
$old_pos = ftell($c->file);
// Reposition the file pointer and
// load the object header.
$c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]);
$header = $this->pdf_read_value($c, null, true);
if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) {
$this->fpdi->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location");
}
// If we're being asked to store all the information
// about the object, we add the object ID and generation
// number for later use
if ($encapsulate) {
$result = array(PDF_TYPE_OBJECT, 'obj' => $obj_spec[1], 'gen' => $obj_spec[2]);
} else {
$result = array();
}
// Now simply read the object data until
// we encounter an end-of-object marker
while (1) {
$value = $this->pdf_read_value($c);
if ($value === false) {
return false;
}
if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') {
break;
}
$result[] = $value;
}
$c->reset($old_pos);
if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) {
$result[0] = PDF_TYPE_STREAM;
}
return $result;
}
} else {
return $obj_spec;
}
}
示例14: sendMessage
/**
* Send message to queue
*
* @return bool
*/
public function sendMessage($message)
{
if ($this->error()) {
return false;
}
$ret = $this->queue->push($message);
if ($ret === false || $this->queue->error()) {
$this->error('Send messages failure,error:' . $this->queue->error());
Logger::error($this->error());
return false;
}
return true;
}
示例15: renderImage
/**
* do the resizes like Pageimage does it
*
* @param object $caller
* @param pageimage $img
* @param string $targetFilename
* @param array $options1
* @param array $options2
* @return pageimage
*/
public static function renderImage(&$caller, &$img, $sourceFilename, $targetFilename, $width, $height, $options)
{
$filenameFinal = $targetFilename;
$filenameUnvalidated = $img->pagefiles->page->filesManager()->getTempPath() . basename($targetFilename);
if (file_exists($filenameFinal)) {
@unlink($filenameFinal);
}
if (file_exists($filenameUnvalidated)) {
@unlink($filenameUnvalidated);
}
if (@copy($sourceFilename, $filenameUnvalidated)) {
try {
$sizer = new ImageSizer($filenameUnvalidated);
$sizer->setOptions($options);
if ($sizer->resize($width, $height) && @rename($filenameUnvalidated, $filenameFinal)) {
// if script runs into a timeout while in ImageSizer, we never will reach this line and we will stay with $filenameUnvalidated
if ($caller->config->chmodFile) {
chmod($filenameFinal, octdec($caller->config->chmodFile));
}
} else {
$caller->error = "ImageSizer::resize({$width}, {$height}) failed for {$filenameUnvalidated}";
}
} catch (Exception $e) {
$caller->error = $e->getMessage();
}
} else {
$caller->error("Unable to copy {$sourceFilename} => {$filenameUnvalidated}");
}
$pageimage = clone $img;
// if desired, user can check for property of $pageimage->error to see if an error occurred.
// if an error occurred, that error property will be populated with details
if ($caller->error) {
// error condition: unlink copied file
if (is_file($filenameFinal)) {
@unlink($filenameFinal);
}
if (is_file($filenameUnvalidated)) {
@unlink($filenameUnvalidated);
}
// write an invalid image so it's clear something failed
$data = "This is intentionally invalid image data.\n{$caller->error}";
if (file_put_contents($filenameFinal, $data) !== false) {
wireChmod($filenameFinal);
}
// we also tell PW about it for logging and/or admin purposes
$caller->error($caller->error);
}
$pageimage->setFilename($filenameFinal);
$pageimage->setOriginal($img);
return $pageimage;
}