本文整理汇总了PHP中Psc\Code\Code::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Code::getClass方法的具体用法?PHP Code::getClass怎么用?PHP Code::getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psc\Code\Code
的用法示例。
在下文中一共展示了Code::getClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
protected function log(\Exception $e, $contextInfo = NULL)
{
if ($e instanceof \ErrorException) {
$errorType = self::$errors[$e->getSeverity()];
} else {
$errorType = Code::getClass($e);
}
// wir müssen hier den error selbst loggen, da php nichts mehr macht (die faule banane)
$php = NULL;
$php .= 'PHP ' . $errorType . ': ' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n";
$php .= $errorType . ': ' . \Psc\Exception::getExceptionText($e, 'text') . "\n";
error_log($php, 0);
/* Debug-Mail */
$debug = NULL;
$debug .= '[' . date('d.M.Y H:i:s') . "] ";
$debug .= $errorType . ': ' . \Psc\Exception::getExceptionText($e, 'text') . "\n";
if ($e instanceof \Psc\Code\ErrorException) {
$debug .= "\n" . $e->contextDump;
}
if (isset($contextInfo)) {
$debug .= "\nContextInfo: \n" . $contextInfo;
}
if (isset($this->recipient) && !PSC::inTests()) {
if ($ret = @mail($this->recipient, '[Psc-ErrorHandler] [' . $e->getCode() . '] ' . $e->getMessage(), $debug, 'From: www@' . PSC::getEnvironment()->getHostName() . "\r\n" . 'Content-Type: text/plain; charset=UTF-8' . "\r\n") === FALSE) {
error_log('[\\Psc\\Code\\ErrorHandler.php:' . __LINE__ . '] Die Fehlerinformationen konnten nicht an den lokalen Mailer übergeben werden.', 0);
}
}
}
示例2: callGetter
/**
* Ruft den Getter für das Feld $field auf dem Entity auf
*
* @param string $field der Name des Feldes in CamelCase
* @return mixed
*/
public function callGetter($field)
{
$f = 'get' . ucfirst($field);
if (!method_exists($this, $f)) {
throw new \InvalidArgumentException($f . '() existiert nicht in ' . \Psc\Code\Code::getClass($this));
}
return $this->{$f}();
}
示例3: assertRoutingException
public function assertRoutingException(Closure $c, $debugMessage = '')
{
try {
$c();
} catch (\Exception $e) {
if ($e instanceof \Psc\CMS\Service\ControllerRouteException || $e instanceof \Psc\Net\HTTP\HTTPException || $e instanceof \Psc\Net\RequestMatchingException) {
return;
} else {
$this->fail('Exception: Psc\\CMS\\Service\\ControllerRouteException oder Psc\\Net\\RequestMatchingException erwartet. Es wurde aber ' . \Psc\Code\Code::getClass($e) . ' gecatched. (ExceptionMessage: ' . $e->getMessage() . ') ' . $debugMessage);
}
}
$this->fail('Exception: Psc\\CMS\\Service\\ControllerRouteException oder Psc\\Net\\RequestMatchingException erwartet. Es wurde aber keine gecatched. ' . $debugMessage);
}
示例4: doInit
protected function doInit()
{
// damit die components der form innerhalb des formpanels an der richtigen stelle stehen
// holen wir uns diese aus der Componentsform
foreach ($this->form->getComponents() as $key => $component) {
try {
$this->content['component' . $key] = $component->html();
} catch (\Psc\Exception $e) {
throw new \Psc\Exception('Component ' . Code::getClass($component) . ' verursachte einen Fehler beim HTML-Erzeugen', 0, $e);
}
}
parent::doInit();
}
示例5: testAfterLogoutValidateIsNotOkay
public function testAfterLogoutValidateIsNotOkay()
{
// pre: validate does not throw exception
$this->auth->login($this->id, $this->pw);
$this->expectUserInDB();
$this->auth->validate();
// now logout
$this->auth->logout();
try {
$this->auth->validate();
$this->fail('validate sollte eine exception schmeissen, da der User ausgeloggt ist');
} catch (NoAuthException $e) {
return;
}
$this->fail('Falsche Exception Gecatched: ' . \Psc\Code\Code::getClass($e));
}
示例6: getAnnotationName
/**
* @param PscAnnotation|DoctrineAnnotation $annotation
*/
public function getAnnotationName($annotation)
{
if ($annotation instanceof PscAnnotation) {
$name = $annotation->getAnnotationName();
} else {
$name = \Psc\Code\Code::getClass($annotation);
}
if (isset($this->defaultAnnotationNamespace) && mb_strpos($name, $this->defaultAnnotationNamespace) === 0) {
return mb_substr($name, mb_strlen($this->defaultAnnotationNamespace) + 1);
}
foreach ($this->annotationNamespaceAliases as $alias => $namespace) {
if (mb_strpos($name, $namespace) === 0) {
return $alias . '\\' . mb_substr($name, mb_strlen($namespace) + 1);
}
}
return '\\' . $name;
}
示例7: walk
protected function walk($ast)
{
if (is_object($ast)) {
$this->stack[] = Code::getClass($ast);
}
/* es muss nach der "spezialität" von Klassen sortiert werden
die Klassen am tiefsten in der Hierarchie müssen nach oben
gleichzeitig ist die Schleife auch Performance-Kritisch
*/
if ($ast instanceof \Psc\HTML\Page) {
return $this->walkPage($ast);
} elseif ($ast instanceof \Bugatti\Templates\LanguagePicker) {
return $this->walkLanguagePicker($ast);
} elseif ($ast instanceof \Bugatti\Templates\Headline) {
return $this->walkHeadline($ast);
} elseif ($ast instanceof \Bugatti\Templates\NavigationLevel) {
return $this->walkNavigationLevel($ast);
} elseif ($ast instanceof \Bugatti\Templates\Section) {
return $this->walkContainer($ast);
} elseif ($ast instanceof \Bugatti\Templates\Container) {
return $this->walkContainer($ast);
} elseif ($ast instanceof \Psc\Data\ArrayCollection) {
return $this->walkCollection($ast);
} elseif ($ast instanceof \Bugatti\Templates\LayoutTable) {
return $this->walkLayoutTable($ast);
} elseif ($ast instanceof \Bugatti\Templates\ContentTable) {
return $this->walkContentTable($ast);
}
if (is_string($ast)) {
return $ast;
}
if (is_int($ast)) {
return $ast;
}
if (is_array($ast)) {
return $ast;
}
var_dump($this->stack);
throw new ASTException('kann mit dem Part: ' . Code::varInfo($ast) . ' nichts anfangen');
}
示例8: compile
public function compile()
{
$gClass = new \Psc\Code\Generate\GClass(\Psc\Code\Code::getClass($this));
$gClass->elevateClass();
$this->log('compiling ProjectEntities:');
foreach ($gClass->getMethods() as $method) {
if (\Psc\Preg::match($method->getName(), '/^compile[a-z0-9A-Z_]+$/') && $method->isPublic()) {
$this->modelCompiler = NULL;
// neuen erzeugen damit flags resetted werden, etc
$m = $method->getName();
$this->log(' ' . $m . ':');
try {
$out = $this->{$m}($this->getModelCompiler());
} catch (\Doctrine\DBAL\DBALException $e) {
if (mb_strpos($e->getMessage(), 'Unknown column type') !== FALSE) {
$types = A::implode(\Doctrine\DBAL\Types\Type::getTypesMap(), "\n", function ($fqn, $type) {
return $type . "\t\t" . ': ' . $fqn;
});
throw new \Psc\Exception('Database Error: Unknown Column Type: types are: ' . "\n" . $types, $e->getCode(), $e);
}
throw $e;
} catch (\Exception $e) {
$this->log(' Fehler beim Aufruf von ' . $m);
throw $e;
}
if ($out instanceof \Webforge\Common\System\File) {
$this->log(' ' . $out . ' geschrieben');
} elseif (is_array($out)) {
foreach ($out as $file) {
$this->log(' ' . $file . ' geschrieben');
}
} elseif ($out instanceof \Psc\Doctrine\EntityBuilder) {
$this->log(' ' . $out->getWrittenFile() . ' geschrieben');
}
}
}
$this->log('finished.');
return $this;
}
示例9: decorateWalkable
public function decorateWalkable($walkable, $walkedFields)
{
return '@' . Code::getClass($walkable) . '(' . implode(', ', $walkedFields) . ')';
}
示例10: __toString
/**
* @cc-ignore
*/
public function __toString()
{
return '[class ' . Code::getClass($this) . ' not converted to string]';
}
示例11: findService
/**
* Sucht den ersten der Services, der den Request bearbeiten will
*
* @throws NoServiceFoundException
*/
public function findService(ServiceRequest $serviceRequest)
{
$this->log('Find Services..');
foreach ($this->services as $service) {
$this->log('Service: ' . Code::getClass($service) . '::isResponsibleFor');
if ($service->isResponsibleFor($serviceRequest)) {
$this->log('ok: Service übernimmt den Request');
return $service;
}
}
throw NoServiceFoundException::build('Es konnte kein passender Service ermittelt werden. Es wurden %d Services (%s) befragt.', count($this->services), \Webforge\Common\ArrayUtil::implode($this->services, ', ', function ($svc) {
return Code::getClass($svc);
}))->set('serviceRequest', $serviceRequest)->end();
}
示例12: getEntityName
/**
* Gibt den FQN des Entities zurück
*
* dies kann man zur Performance überschreiben
* @return string
*/
public function getEntityName()
{
return \Psc\Code\Code::getClass($this);
}
示例13: registerCacheAdapter
public function registerCacheAdapter(CacheAdapter $adapter, $name = NULL)
{
if (!isset($name)) {
$name = Code::getClassName(Code::getClass($adapter));
}
$this->registeredCacheAdapters[$name] = $adapter;
return $this;
}
示例14: getRepositoryMock
public function getRepositoryMock(\Psc\Code\Test\Base $testCase, $entityName, array $methods = NULL)
{
$realRepository = $this->getRepository($entityName);
$class = Code::getClass($realRepository);
return $testCase->getMock($class, $methods, array($this, $this->getClassMetadata($entityName)));
}
示例15: deploy
public function deploy()
{
$this->init();
$this->logf('Starting Deployment [%s%s] to %s', $this->project->getName(), $this->variant ? '.' . $this->variant : NULL, $this->target);
foreach ($this->tasks as $task) {
try {
$label = $task instanceof LabelTask ? $task->getLabel() : Code::getClassName(Code::getClass($task));
$this->logf('** Task: %s', $label);
$task->run();
} catch (\Webforge\Common\Exception\MessageException $e) {
$e->prependMessage('ERROR in task ' . $label . '. ');
throw $e;
}
}
$this->logf('finished Deployment [%s%s]', $this->project->getName(), $this->variant ? '.' . $this->variant : NULL);
}