public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (!in_array($value, $this->getValues())) { throw new \InvalidArgumentException("Invalid '" . $this->name . "' value " . \Psc\Code\Code::varInfo($value) . ' Erlaubt sind: ' . \Psc\Code\Code::varInfo($this->values)); } return $value; }
/** * Überprüft die Daten anhand der Constraints und fügt die Daten zum Index hinzu * * Schmeisst eine Exception wenn die daten bereits im Index sind * diese Exception wird mit duplicateIdentifier gesetzt, wenn in $data der key 'identifier' für den vorigen Index-Eintrag gesetzt war */ public function process(array $data) { foreach ($this->uniqueConstraints as $constraint) { $constraintValue = array(); foreach ($constraint->getKeys() as $key) { // da wir diese reihenfolge nehmen, ist diese immer gleich $type = $constraint->getKeyType($key); if (!array_key_exists($key, $data)) { throw new WrongDataException(sprintf("In Data ist der Schlüssel '%s' nicht vorhanden. Erwartet: '%s'", $key, $type->getName())); } $value = $data[$key]; if (!$this->typeMatcher->isTypeof($value, $type)) { $e = new TypeExpectedException(sprintf("Data %s für Key: '%s' sollte vom Type '%s' sein", \Psc\Code\Code::varInfo($value), $key, $type->getName())); $e->expectedType = $type; throw $e; } $constraintValue[$key] = $value; } // schlüssel darf es nicht geben, wert nicht gesetzt kann es nicht geben if (($indexEntry = $this->index->get($constraintValue, FALSE, DataInput::THROW_EXCEPTION)) === FALSE) { // ok: nicht im index => zum index hinzufügen $this->index->set($constraintValue, array_key_exists('identifier', $data) ? $data['identifier'] : TRUE); } else { throw UniqueConstraintException::factory($constraint->getName(), $this->getStringValue($constraintValue), $constraintValue, !is_bool($indexEntry) ? $indexEntry : NULL); } } }
public function matchIValue($value) { if (($p = mb_strtolower($this->part())) === $value) { return $this->success($p); } $this->fail($p . ' matched ' . Code::varInfo($value) . ' nicht'); }
/** * @return list($threadLink, $threadId); */ public function findThread($boardId, Season $season) { $this->logger->writeln('Suche Thread für ' . $season . ' in board: ' . $boardId); $this->req = new URLRequest('http://www.subcentral.de/index.php?page=Board&boardID=' . $boardId, $this->cookieJar); $html = $this->req->init()->process(); /* wir holen uns den richtigen Thread aus den "wichtigen Themen" */ $dom = xml::doc($html); $res = xml::query($dom, '#stickiesStatus table td.columnTopic div.topic p'); $stickies = array(); // das sind nicht alle wegen break! foreach ($res as $topicP) { $topicP = xml::doc($topicP); $topicA = A::first(xml::query($topicP, 'a')); $title = (string) $topicA->nodeValue; $stickies[] = $title; $prefix = xml::query($topicP, 'span.prefix strong'); if (count($prefix) == 1 && $prefix[0]->nodeValue == '[Subs]' && Preg::match($title, '/(Staffel\\s*' . $season->getNum() . '|S0*' . $season->getNum() . ')/i') > 0) { $link = $topicA->getAttribute('href'); $threadId = (int) Preg::qmatch($link, '/threadId=([0-9]+)/'); break; } } if (!isset($link)) { $pe = new SubcentralException('Pfad nicht gefunden: "#stickiesStatus table td.columnTopic div.topic p a" in ' . $this->req->getURL() . ' ' . Code::varInfo($stickies)); $e = new SubcentralException('Thread für Staffel: ' . $season->getNum() . ' für Serie: ' . $season->getTvShow()->getTitle() . ' nicht gefunden', 0, $pe); $this->logger->writeln($e->getMessage()); $this->logger->writeln($pe->getMessage()); throw $e; } $link = 'http://www.subcentral.de/' . $link; return array($link, $threadId); }
public function __construct(array $buttons, TranslationContainer $translationContainer, $flags = NULL) { $this->translationContainer = $translationContainer; $this->buttons = array(); foreach ($buttons as $button) { if ($button === 'save') { $this->addSaveButton(); } elseif ($button === 'insert-open') { $this->addInsertOpenButton(); } elseif ($button === 'save-close') { $this->addSaveCloseButton(); } elseif ($button === 'insert-close') { $this->addInsertCloseButton(); } elseif ($button === 'insert') { $this->addInsertButton(); } elseif ($button === 'reload') { $this->addReloadButton(); } elseif ($button === 'reset') { $this->addResetButton(); } elseif ($button === 'view') { $this->addViewButton(); } elseif ($button === 'preview') { $this->addPreviewButton(); } elseif ($button instanceof \Psc\UI\Button) { $this->buttons[] = $button; } else { throw new \InvalidArgumentException('Unbekannter Parameter in array $buttons (1. Parameter) : ' . Code::varInfo($button)); } } if ($flags === NULL) { $this->flags = self::ALIGN_RIGHT | self::CLEAR; } else { $this->flags = $flags; } }
/** * @var mixed $print Closure|String wenn ein String wird dies als Attribute gesehen welches mit get$print() vom Objekt geladen werden kann */ public static function listObjects($objectCollection, $sep = ', ', $print = 'Id', $andsep = NULL, Closure $formatter = NULL) { $objectCollection = Code::castArray($objectCollection); $cnt = count($objectCollection); if (isset($andsep) && $cnt > 1) { $last = array_pop($objectCollection); } else { $andsep = NULL; } if (is_string($print) || $print instanceof Closure) { $g = Code::castGetter($print); } else { throw new \InvalidArgumentException('Unbekannter Parameter für $print: ' . Code::varInfo($print)); } $formatter = $formatter ?: function ($item) { return (string) $item; }; $ret = A::implode($objectCollection, $sep, function ($object, $key) use($g, $formatter) { // formatiere das $print-Attribute von $object return $formatter($g($object, $key), $key); }); if (isset($andsep) && $last != NULL) { $ret .= $andsep . $formatter($g($last)); } return $ret; }
/** * Erstellt eine neue Rule durch eine Spezifikation (was so quasi alles sein kann) * * Die Parameter dieser Funktion sind sehr Variabel * Möglicherweise ist es einfacher generate[A-Za-z+]Rule zu benutzen */ public static function generateRule($ruleSpecification) { $rs = $ruleSpecification; if (is_string($rs)) { if ($rs == 'nes') { return new NesValidatorRule(); } if ($rs == 'id') { return new IdValidatorRule(); } if ($rs == 'pi' || $rs == 'pint') { return new PositiveIntValidatorRule(); } if ($rs == 'array') { return new ArrayValidatorRule(); } if ($rs == 'pi0' || $rs == 'pint0') { $rule = new PositiveIntValidatorRule(); $rule->setZeroAllowed(TRUE); return $rule; } if (S::startsWith($rs, '/') && S::endsWith($rs, '/')) { return self::generateRegexpRule($rs); } $c = '\\' . __NAMESPACE__ . '\\' . ucfirst($rs) . 'ValidatorRule'; if (class_exists($c)) { return new $c(); } throw new \Psc\Exception('Unbekannte Parameter für generateRule ' . Code::varInfo($rs)); } if (is_array($rs)) { $num = count($rs); } throw new \Psc\Exception('Unbekannte Parameter für generateRule ' . Code::varInfo($rs)); }
/** * Validiert die Daten zu einem Feld * * gibt die Daten zurück! * Wenn das Feld nicht validiert werden, wird eine Exception geworfen! * @throws ValidatorException wenn die Daten nicht zum Feld passen * * ist $flags OPTIONAL gesetzt und wird die Rule eine EmptyDataException werfen, wird der DefaultWert (normal: NULL) der Exception zurückgegeben * wenn $this->dataProvider gesetzt ist, wird IMMER $this->dataProvider->getValidatorData() benutzt und nicht der $data Parameter */ public function validate($field, $data = NULL, $flags = 0x0) { $key = $this->getKey($field); if (isset($this->dataProvider)) { $data = $this->dataProvider->getValidatorData($field); } if ($this->hasField($field)) { try { foreach ($this->rules[$key] as $rule) { $data = $rule->validate($data); // wenn wir hier data zurückgeben, können wir die rules chainen } } catch (EmptyDataException $e) { if (($flags & self::OPTIONAL) == self::OPTIONAL || $this->isOptional($field)) { return $e->getDefaultValue(); } else { if ($e->getMessage() == NULL) { $e->setMessage(sprintf($this->standardEmptyMessage, $this->getKey($field))); } throw $this->convertToValidatorException($e, $field, $data); } } catch (\Exception $e) { throw $this->convertToValidatorException($e, $field, $data); } } else { throw new \Psc\Exception('Feld: ' . Code::varInfo($field) . ' ist dem Validator nicht bekannt.'); } return $data; }
public function get($identifier) { try { return $this->repository->hydrate($identifier); } catch (\Psc\Doctrine\EntityNotFoundException $e) { throw new NoUserException('User mit dem Identifier: ' . Code::varInfo($identifier) . ' nicht gefunden.', 0, $e); } }
/** * @param array Webforge\Types[] Schlüssel sind Namen der Felder (Ebenen getrennt mit .), Werte sind Webforge\Types\Type-Objekte */ public function addTypesFromArray(array $types) { foreach ($types as $field => $type) { if (!$type instanceof Type) { throw new TypeExpectedException('Instances from Type as values from the array expected. ' . Code::varInfo($type) . ' was provided.'); } $this->setFieldType($field, $type); } return $this; }
/** * $message->setTo(self::recipient('*****@*****.**')); * * @return korrektes Format für Message::set(From|To|Bcc|Cc) */ public static function recipient($recipient) { if (is_string($recipient)) { return $recipient; } if (is_array($recipient)) { return $recipient; } // @TODO checks? throw new Exception('Unbekannter Parameter: ' . Code::varInfo($recipient)); }
public function export() { $export = array(); foreach ($this->toArray() as $key => $element) { if (!$element instanceof Exportable) { throw new Exception('Jedes Element einer ArrayExportCollection muss ein Exportable sein. ' . Code::varInfo($element)); } $export[$key] = $element->export(); } return $export; }
protected function getThumbnailFormat($format) { if (array_key_exists($format, $this->formats)) { $arguments = $this->formats[$format]; $options = array(); if (count($arguments) == 4) { $options = array_pop($arguments); } return (object) array('arguments' => $arguments, 'options' => $options); } throw new \Psc\Exception('Unbekanntes Format: ' . Code::varInfo($format)); }
/** * * $hydrator = new Hydrator('FoodTag', $doctrinePackage); * $tags = $hydrator->byList(array('hot','special','spicy'), 'label'); * * @return array */ public function byList(array $list, $field, $checkCardinality = TRUE, &$found = NULL) { if ($list == NULL) { return array(); } $result = $this->getRepository()->findBy(array($field => $list)); $found = count($result); if ($checkCardinality && $found != count($list)) { throw new \Psc\Exception('Es konnten nicht alle Felder aus der Liste geladen werden. Gefunden: ' . $found . ' in der Liste waren aber: ' . count($list) . ' Liste: ' . Code::varInfo($list)); } return $result; }
public function setCode($code, $reason = NULL) { if (!is_integer($code)) { throw new \InvalidArgumentException('Code muss ein Integer sein: ' . Code::varInfo($code)); } $this->code = $code; if (!array_key_exists($this->code, self::$reasons)) { throw new \InvalidArgumentException('Response Code: ' . $code . ' ist nicht bekannt'); } $this->reason = $reason ?: self::$reasons[$this->code]; return $this; }
/** * @param ResponseHeader|array|string $headers * @return Psc\Net\HTTP\Response */ public static function create($code, $body = NULL, $header = NULL) { if ($header === NULL) { $header = new ResponseHeader($code); } elseif (is_array($header)) { $header = new ResponseHeader($code, $header); } elseif ($header instanceof ResponseHeader) { } elseif (is_string($header)) { $header = ResponseHeader::parse($header); } else { throw new \InvalidArgumentException('Header hat ein Falsches Format. ' . Code::varInfo($headers)); } return new static($code, $body, $header); }
/** * @dataProvider getFixtures */ public function testGetFlatForUI($fixture, $context) { $this->controller->setContext($context); $flat = $this->getFlatForUI($this->defaultLanguage, $this->languages); foreach ($flat as $node) { $this->assertArrayHasKey('de', (array) $node->title, Code::varInfo($node->title)); //$this->assertArrayHasKey('fr', (array) $node->title, Code::varInfo($node->title)); $this->assertArrayHasKey('de', (array) $node->slug, 'slug' . Code::varInfo($node->slug)); $this->assertNotEmpty($node->slug->de); //$this->assertObjectHasAttribute('fr', $node->slug, 'slug'.Code::varInfo($node->slug)); //$this->assertNotEmpty($node->slug->fr,'slug für fr ist nicht gesetzt'.Code::varInfo($node->slug)); $this->assertEquals('de', $node->locale); $this->assertObjectHasAttribute('depth', $node, print_r(array_keys((array) $node), true)); } }
/** * * Wird EmptyDataException bei validate() geworfen und ist der Validator mit optional aufgerufen worden, wird keine ValidatorException geworfen * @return $data */ public function validate($data = NULL) { if ($data === NULL || $data === array()) { throw EmptyDataException::factory(new \Psc\Data\ArrayCollection()); } if (!is_array($data)) { throw new \InvalidArgumentException('Parameter ist als Array erwartet. ' . Code::varInfo($data) . ' wurde übergeben'); } $identifierCaster = $this->getIdentifierCaster($this->entityMeta->getIdentifier()); $repository = $this->dc->getRepository($this->entityMeta->getClass()); $entities = new ArrayCollection(); foreach ($data as $key => $identifierString) { $identifier = $identifierCaster($identifierString, $key); $entities->add($repository->hydrate($identifier)); } return $entities; }
/** * */ protected function getURLContents() { if (isset($this->cache) && !$this->refresh) { $contents = $this->cache->load('URLContents', $loaded); if ($loaded) { return $contents; } } $contents = $this->request->init()->process(); if ($contents === FALSE) { throw new Exception('URL konnte nicht gelesen werden: ' . Code::varInfo($this->request->getURL())); } if (isset($this->cache)) { $this->cache->store('URLContents', $contents); } return $contents; }
/** * @controller-api */ public function get(array $tplName) { $__variablesDefinitions = array(); try { $tpl = new Template($tplName); $tpl->setLanguage(Config::req('i18n.language')); $tpl->setVars($__variablesDefinitions); if (!$tpl->validate()) { throw new \Psc\TPL\MissingFileException('Template ist nicht valid!'); } if (!$tpl->getFile()->exists()) { throw new \Psc\TPL\MissingFileException('Template-File: ' . $tpl->getFile() . ' existiert nicht'); } return $tpl->get(); } catch (\Psc\TPL\MissingFileException $e) { throw HTTPException::NotFound('Das Template: ' . Code::varInfo($tplName) . ' ist nicht vorhanden', $e); } }
public function init() { $ws = $this->getOption('worksheet'); /* Reader und so */ $this->reader->setReadFilter(new RangeReadFilter($this->getOption('maxColumn'), $this->getOption('maxRow'))); //$this->reader->setLoadSheetsOnly(array($ws)); // ich glaub das geht nicht bei numeric $this->excel = $this->reader->load($this->importFile); if (is_numeric($ws)) { $this->sheet = $this->excel->getSheet($ws); } else { $this->sheet = $this->excel->getSheetByName($ws); } if ($this->sheet == NULL) { throw new \Psc\Exception('Worksheet: ' . Code::varInfo($this->getOption('worksheet')) . ' nicht gefunden.'); } $this->init = TRUE; return $this; }
protected function calculateType() { if (is_string($this->target) && !empty($this->target) && is_string($this->function)) { $this->type = self::TYPE_STATIC_METHOD; } elseif (is_object($this->target) && is_string($this->function)) { $this->type = self::TYPE_METHOD; } elseif ($this->function instanceof Closure) { $this->type = self::TYPE_CLOSURE; $this->target = $this->function; $this->function = NULL; } elseif ($this->target instanceof Closure) { $this->type = self::TYPE_CLOSURE; $this->function = NULL; } elseif (is_string($this->function) && empty($this->target)) { $this->type = self::TYPE_FUNCTION; $this->target = NULL; } else { throw new \Psc\Exception('Invalide Kombination von Argumenten: target: ' . Code::varInfo($this->target) . ' function: ' . Code::varInfo($this->function)); } }
/** * Gibt den (lcfirst) LowerCase Name für einen Klassennamen zurück * * OID => oid * OIDMeta => oidMeta * SomeClassName => someClassName * * @param $className ohne Namespace */ public function propertyName($className) { if (!is_string($className) || mb_strpos($className, '\\') !== FALSE) { throw new \InvalidArgumentException(sprintf("ClassName %s kann nicht zu propertyName umgewandelt werden. Er muss ein String sein und darf nur der ClassName sein", \Psc\Code\Code::varInfo($className))); } // 1. Fall: Klasse ist CamelCase. wichtig ist hierbei dass das erste a klein ist if (Preg::match($className, '/^[A-Z]{1}[a-z]{1}/') > 0) { return lcfirst($className); } // 2. Fall: Klassename ist eine Abkürzung. Z. B. OID (aka: der ganze String sind Großbuchstaben) if (Preg::match($className, '/^[A-Z]+$/')) { return mb_strtolower($className); } // 3. Fall: KlassenName ist mixed sowas wie OIDMeta // teile auf in m[1] = 'OID' m[2] = 'Meta' $m = array(); if (Preg::match($className, '/^([A-Z]+)([A-Z]{1}[a-z]{1}.*)$/', $m) > 0) { return mb_strtolower($m[1]) . $m[2]; } throw new \RuntimeException(sprintf("Kein matching Case für ClassName '%s'", $className)); }
public static function convertPDOException(\PDOException $e) { $exceptions = array('\\Psc\\Doctrine\\ForeignKeyConstraintException', '\\Psc\\Doctrine\\UniqueConstraintException', '\\Psc\\Doctrine\\TooManyConnectionsException', '\\Psc\\Doctrine\\UnknownColumnException'); /* grml. fix pdo */ if ($e->errorInfo === NULL && mb_strlen($msg = $e->getMessage()) > 0) { //SQLSTATE[08004] [1040] Too many connections if (\Psc\Preg::match($msg, '/SQLSTATE\\[([0-9]+)\\]\\s*\\[([0-9]+)\\]\\s*(.*)?/s', $m)) { $e->errorInfo[0] = $m[1]; $e->errorInfo[1] = $m[2]; $e->errorInfo[2] = $m[3]; } } foreach ($exceptions as $cname) { if ($cname::check($e)) { return new $cname($e); } } //throw new \Psc\Exception('unconverted PDO Exception: '.Code::varInfo($e->errorInfo),0,$e); print 'unconverted PDOException: ' . Code::varInfo($e->errorInfo); return $e; }
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'); }
protected function createEntity() { $fields = $this->fields->toArray(); // @TODO hier könne es sein dass unset sehr lahm ist. man könnte auch array_intersect oder sowas nehmen oder im constructor foreach was anders machen etc // zuerst die ausm constructor $constructParams = array(); foreach ($this->getConstructorFields() as $field) { $constructParams[] = $this->fields->get($field); unset($fields[$field]); } // construct try { $entity = $this->getGClass()->newInstance($constructParams); } catch (\ErrorException $e) { throw new \Psc\Exception(sprintf("Fehler beim Erstellen des Entities: '%s'. Es wurden %d (%s) Parameter an den Constructor übergeben. Fehler: %s", $this->entityMeta->getEntityName(), count($constructParams), Code::varInfo($constructParams), $e->getMessage()), 0, $e); } // restliche Felder (oben haben wir alle aus dem constructor unsetted) foreach ($fields as $field => $value) { if (!$this->entityMeta->getPropertyMeta($field)->isAutogeneratedValue()) { $entity->callSetter($field, $value); } } return $entity; }
/** * Fügt ein Property hinzu * * added das Property, seine Setter und gegebenfalls auch einen Eintrag im Constructor */ public function compile(GClass $gClass, $flags = 0x0) { // das ist okay, wenn man getters oder setters oder den constructor adden will (imo) //if ($gClass->hasProperty($this->property->name)) { // throw new \InvalidArgumentException('Property: '.$this->property->name. ' besteht bereits in Klasse '.$gClass); //} $this->createClassBuilder($gClass); $this->cProperty = $this->classBuilder->addProperty($this->property->name, $this->property->type); if ($this->property->upcaseName) { $this->cProperty->setUpcaseName($this->property->upcaseName); } if ($this->generateSetter) { $this->classBuilder->generateSetter($this->cProperty, NULL, ClassBuilder::INHERIT); } if ($this->generateGetter) { $this->classBuilder->generateGetter($this->cProperty, NULL, ClassBuilder::INHERIT); } if (($cs = $this->generateInConstructor) !== FALSE) { $constructor = $this->classBuilder->getConstructor(TRUE); if (!$constructor->hasParameter($this->property->name)) { $parameter = new GParameter($this->property->name, $this->property->type ? $this->property->type->getPHPHint() : NULL, $this->constructorDefaultValue); $constructor->addParameter($parameter, $this->generateInConstructor); if ($this->dependencyInjection === self::DEPENDENCY_INJECTION_CONSTRUCTOR) { if (!$this->property->type instanceof ObjectType || !$this->property->type->hasClass()) { throw new \InvalidArgumentException('Wenn DependencyInjection CONSTRUCTOR ist, muss der property-type ein ObjectType sein mit einer Klasse. Type ist: ' . Code::varInfo($this->property->type)); } $objectValue = new Expression(sprintf('$%s ?: new %s()', $parameter->getName(), $this->property->type->getGClass()->getClassName())); } else { $objectValue = new AST\Variable($parameter->getName(), new AST\LType('Mixed')); } $constructor->appendBodyLines(array($this->codeWriter->callSetter(new AST\Variable('this', new AST\LType('Object')), $this->cProperty->getUpcaseName(), $objectValue) . ';')); } } $this->classBuilder->generateDocBlocks(); return $gClass; }
/** * Gibt einen Pfad zu einem Wert aus dem Array zurück * * Ableitenden Klassen können dann sowas machen: * * public function bla() { * $keys = func_get_args(); * return $this->getDataWithKeys($keys, self::THROW_EXCEPTION); * } * * oder so * * kann keine Defaults sondern nur return NULL oder eine Exception schmeissen */ public function getDataWithKeys(array $keys, $do = self::RETURN_NULL) { $data = $this->data; foreach ($keys as $key) { if (is_array($key)) { throw new InvalidArgumentException('$keys kann nur ein Array von Strings sein. ' . Code::varInfo($keys)); } if (!is_array($data) || !array_key_exists($key, $data)) { if ($do === self::RETURN_NULL) { return NULL; } else { $e = new DataInputException('Konnte Schlüssel: "' . implode('.', $keys) . '" nicht finden'); $e->keys = $keys; throw $e; } } $data = $data[$key]; } if (is_array($data)) { return $this->cleanArray($data); } else { return $this->clean($data); } }
public function __toString() { try { $str = 'Event[' . $this->getIdentifier() . '] ' . "\n"; $str .= 'Target: ' . Code::varInfo($this->target) . "\n"; $str .= 'Daten: ' . \Psc\Doctrine\Helper::getDump($this->data, $maxDepth = 1) . "\n"; } catch (\Exception $e) { print $e; exit; } return $str; }
/** * FEHLER: Eine Resource die zum ausführen des Requests benötigt wird, wurde niicht gefunden * * z. B. Ein PUT Request wird für ein Entity gemacht welches nicht mehr vorhanden ist * für ein Entity soll ein Formular geladen werden, und der Identifier ergibt kein ergebnis in der Datenbank */ public function resourceNotFound($method, $resourceType, $argumentValues, \Exception $e = NULL) { return HTTPException::NotFound(sprintf("Die Resource '%s' konnte nicht mit den Parametern %s gefunden werden. Der Request konnte nicht vollständig ausgeführt werden. Möglicherweise ist die Resource nicht mehr vorhanden.", $resourceType, Code::varInfo($argumentValues)), $e); }