本文整理汇总了PHP中object::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP object::getFile方法的具体用法?PHP object::getFile怎么用?PHP object::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::getFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prePersistEntity
/**
* Allows applications to modify the entity associated with the item being
* created before persisting it.
*
* @param object $entity
*/
protected function prePersistEntity($entity)
{
if ($entity instanceof Gallery) {
if (null !== $entity->getFile()) {
$entity->setPath($this->uploadFile($entity->getFile()));
$entity->setFile();
}
}
$entity->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
$entity->setModifiedAt(new \DateTime(date('Y-m-d H:i:s')));
$entity->setCreatedBy(12);
}
示例2: testAddFile
/**
* Test add file
*
* @param array $file - list of file data
*
* @dataProvider providerFile
*
* @return array
*/
public function testAddFile($file)
{
$this->uploader->addFile($file);
$file = $this->uploader->getFile();
$this->assertArrayHasKey('name', $file);
$this->assertArrayHasKey('mime', $file);
$this->assertArrayHasKey('path', $file);
$this->assertEquals('TestImage.png', $file['name']);
$this->assertEquals(File\MimeType::PNG, $file['mime']);
$this->assertEquals('TestImages/TestImage.png', $file['path']);
$this->assertFileExists($file['path']);
return $file;
}
示例3: getExceptionArray
/**
* @todo: catch getPrevious() exception
*
* @param object $exception Exception
*
* @return multitype:multitype:Ambigous <NULL, unknown>
*/
public function getExceptionArray($exception)
{
$_trace = [];
foreach ($exception->getTrace() as $key => $item) {
$_trace[$key] = ['file' => isset($item['file']) ? $item['file'] : null, 'line' => isset($item['line']) ? $item['line'] : null, 'function' => isset($item['function']) ? $item['function'] : null, 'class' => isset($item['class']) ? $item['class'] : null];
}
return ['message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'requestUri' => isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null, 'serverName' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null, 'date' => date('d.m.Y H:i'), 'trace' => $_trace, 'ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null, 'get' => Yii::$app->request->get(), 'post' => Yii::$app->request->post()];
}
示例4: handleException
/**
* Обработчик непойманых исключений
*
* @param object $exception - объект исключения
*/
public static function handleException($exception)
{
ob_end_clean_all();
$detals = array();
$detals['File'] = str_replace([ROOT_PATH, '\\'], ['', '/'], $exception->getFile());
$detals['Line'] = $exception->getLine();
$detals['Msg'] = $exception->getMessage();
Error::e503($detals);
}
示例5: 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;
}
示例6: 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;
}
}
示例7: renderBacktrace
/**
* Render the backtrace
*
* @return string The contents of the backtrace
*/
public function renderBacktrace()
{
$contents = null;
$backtrace = $this->error->getTrace();
if (is_array($backtrace)) {
ob_start();
$j = 1;
$html = array();
$html[] = '<table class="backtrace">';
$html[] = ' <caption>Call stack</caption>';
$html[] = ' <thead>';
$html[] = ' <tr>';
$html[] = ' <th scope="col">#</th>';
$html[] = ' <th scope="col">Function</th>';
$html[] = ' <th scope="col">Location</th>';
$html[] = ' </tr>';
$html[] = ' </thead>';
$html[] = ' <tbody>';
$html[] = ' <tr>';
$html[] = ' <th scope="row">0</th>';
$html[] = ' <td><span class="msg">!! ' . $this->error->getMessage() . ' !!</span></td>';
$html[] = ' <td><span class="fl">' . $this->rooted($this->error->getFile()) . '</span>:<span class="ln">' . $this->error->getLine() . '</span></td>';
$html[] = ' </tr>';
for ($i = count($backtrace) - 1; $i >= 0; $i--) {
$html[] = ' <tr>';
$html[] = ' <th scope="row">' . $j . '</th>';
if (isset($backtrace[$i]['class'])) {
$html[] = ' <td><span class="cls">' . $backtrace[$i]['class'] . '</span><span class="opn">' . $backtrace[$i]['type'] . '</span><span class="mtd">' . $backtrace[$i]['function'] . '</span>()</td>';
} else {
$html[] = ' <td><span class="fnc">' . $backtrace[$i]['function'] . '</span>()</td>';
}
if (isset($backtrace[$i]['file'])) {
$html[] = ' <td><span class="fl">' . $this->rooted($backtrace[$i]['file']) . '</span>:<span class="ln">' . $backtrace[$i]['line'] . '</span></td>';
} else {
$html[] = ' <td> </td>';
}
$html[] = ' </tr>';
$j++;
}
$html[] = ' </tbody>';
$html[] = '</table>';
echo "\n" . implode("\n", $html) . "\n";
$contents = ob_get_contents();
ob_end_clean();
}
return $contents;
}
示例8: exceptionHandler
/**
* User exception handler
*
* @param object $exc hold error data
* @return void
**/
public static function exceptionHandler($exc)
{
$errno = $exc->getCode();
$errmsg = $exc->getMessage();
$filename = $exc->getFile();
$linenum = $exc->getLine();
$debug_array = $exc->getTrace();
$back_trace = self::_errorBacktrace($debug_array);
$err = self::_getOutputErrorMsg($errno, $errmsg, $filename, $linenum, $back_trace);
BizSystem::logError($errno, "ExceptionHandler", $errmsg, null, $back_trace);
if (defined('CLI') && CLI) {
echo $err;
} else {
BizSystem::clientProxy()->showErrorMessage($err, true);
}
exit;
}
示例9: rx_exception
/**
* Выводит исключение
*
* @param object $oException Исключение
*/
function rx_exception($oException)
{
if (RUXON_DEBUG) {
$title = 'Ruxon CMS: Исключение';
$content = 'Исключение: ' . $oException->getMessage() . '<br />' . 'В файле: ' . $oException->getFile() . '<br />' . 'В строке: ' . $oException->getLine() . '<br />' . '<pre>' . $oException->getTraceAsString() . '</pre>';
} else {
$title = 'Ruxon CMS: Ошибка';
$content = $oException->getMessage();
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>' . $title . '</title>
</head>
<body>
' . $content . '</body></html>';
}
示例10: download
public function download()
{
if ($this->httpRequest->getExists('id')) {
$iId = $this->httpRequest->get('id');
if (is_numeric($iId)) {
$sFile = @$this->oGameModel->getFile($iId);
$sPathFile = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'game/file/' . $sFile;
if (!empty($sFile) && is_file($sPathFile)) {
$sFileName = basename($sFile);
$this->file->download($sPathFile, $sFileName);
$this->oGameModel->setDownloadStat($iId);
exit(0);
}
}
}
$this->sTitle = t('Wrong download ID specified!');
$this->_notFound();
$this->output();
}
示例11: exceptionHandler
/**
* User exception handler
*
* @param object $exc hold error data
* @return void
* */
public static function exceptionHandler($exc)
{
$errno = $exc->getCode();
$errmsg = $exc->getMessage();
$filename = $exc->getFile();
$linenum = $exc->getLine();
$debug_array = $exc->getTrace();
$back_trace = self::_errorBacktrace($debug_array);
$err = self::_getOutputErrorMsg($errno, $errmsg, $filename, $linenum, $back_trace);
Openbizx::$app->getLog()->logError($errno, "ExceptionHandler", $errmsg, null, $back_trace);
if (defined('CLI') && CLI || self::$errorMode == 'text') {
echo $err;
} else {
Openbizx::$app->getClientProxy()->showErrorMessage($err, true);
}
if (!$exc->no_exit) {
Openbizx::$app->getClientProxy()->printOutput();
exit;
}
}
示例12: handleBadgerException
/**
* function called upon by global exception handler
*
* @param object $e exception thrown
* @return void
*/
function handleBadgerException($e)
{
/**
* Object containing global logging information
*
* @var object
*/
global $logger;
echo "<b>";
echo getBadgerTranslation2('badgerException', 'Error');
echo "</b><br />";
echo getBadgerTranslation2($e->getBadgerErrorPage(), $e->getBadgerErrorId());
/**
* Compiled error message
*
* @var string
*/
$loggedError = "ERROR: - ERROR Module: " . $e->getBadgerErrorPage() . ", ERROR Code: " . $e->getBadgerErrorId() . ", Error Description: " . getBadgerTranslation2($e->getBadgerErrorPage(), $e->getBadgerErrorId(), 'en') . " ON LINE " . $e->getLine() . " IN FILE " . $e->getFile() . " ADDITIONAL INFO " . $e->getAdditionalInfo();
// compile error message to be logged
$logger->log($loggedError);
//write to log file
}
示例13: exception_handler
/**
* 自定义异常处理
*
* @author mrmsl <msl-138@163.com>
* @date 2012-09-12 13:30:32
* @lastmodify 2013-01-22 17:13:09 by mrmsl
*
* @param object $e 异常
*
* @return void 无返回值
*/
function exception_handler($e)
{
$message = $e->__toString();
error_handler(E_APP_EXCEPTION, $e->getMessage(), $e->getFile(), $e->getLine(), '__' . $e->getTraceAsString());
}
示例14: _handleException
/**
* Exception Handler
*
* Do not call this method directly. Function visibility is public because set_exception_handler does not allow for
* protected method callbacks.
*
* @param object $exception The exception to be handled
* @return bool
*/
public function _handleException($exception)
{
$result = false;
if ($this->isEnabled(self::TYPE_EXCEPTION)) {
//Handle \Error Exceptions in PHP7
if (class_exists('Error') && $exception instanceof \Error) {
$message = $exception->getMessage();
$file = $exception->getFile();
$line = $exception->getLine();
$type = E_ERROR;
//Set to E_ERROR by default
if ($exception instanceof \DivisionByZeroError) {
$type = E_WARNING;
}
if ($exception instanceof \AssertionError) {
$type = E_WARNING;
}
if ($exception instanceof \ParseError) {
$type = E_PARSE;
}
if ($exception instanceof \TypeError) {
$type = E_RECOVERABLE_ERROR;
}
$result = $this->_handleError($type, $message, $file, $line, $exception);
} else {
$result = $this->handleException($exception);
}
}
//Let the normal error flow continue
return $result;
}
示例15: soapFaultMsg
/**
* 将异常信息记录到$this->_error中
*
* @param object $e
* @return string
*/
private function soapFaultMsg($e)
{
$this->_error = $e->getMessage() . $e->getFile() . $e->getLine() . $e->getTraceAsString();
}