Loading src/UnicaenLeocarte/Controller/IndexController.php +8 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenLeocarte\Controller; use UnicaenLeocarte\Exception\ExtensionNotLoadedException; use UnicaenLeocarte\Exception\NotFoundException; use UnicaenLeocarte\Exception\RuntimeException; use UnicaenLeocarte\Service\Photo\PhotoServiceAwareInterface; use UnicaenLeocarte\Service\Photo\PhotoServiceAwareTrait; use Zend\Http\PhpEnvironment\Response; Loading Loading @@ -50,17 +51,22 @@ class IndexController extends AbstractActionController implements PhotoServiceAw } } } catch (NotFoundException $e) { catch (NotFoundException $nfe) { // Requête infructueuse. // On tente de fabriquer une image informative... try { $content = $this->photoService->createPhotoIntrouvable(); } catch (ExtensionNotLoadedException $e) { catch (ExtensionNotLoadedException $enle) { // Extension 'gd' non installée $content = ''; } } catch (RuntimeException $re) { // Erreur lors de l'appel du WS error_log("Erreur rencontrée lors de l'appel au web service Leocarte : " . $re->getMessage(), 0); $content = $this->photoService->createPhotoErreur(); } /** @var Response $response */ $response = $this->getResponse(); Loading src/UnicaenLeocarte/Exception/ExtensionNotLoadedException.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace UnicaenLeocarte\Exception; use RuntimeException; class ExtensionNotLoadedException extends RuntimeException { Loading src/UnicaenLeocarte/Exception/NotFoundException.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace UnicaenLeocarte\Exception; use RuntimeException; class NotFoundException extends RuntimeException { Loading src/UnicaenLeocarte/Exception/RuntimeException.php 0 → 100644 +8 −0 Original line number Diff line number Diff line <?php namespace UnicaenLeocarte\Exception; class RuntimeException extends \RuntimeException { } No newline at end of file src/UnicaenLeocarte/Service/Photo/PhotoService.php +14 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,20 @@ class PhotoService implements SoapClientAwareInterface return $imgData; } /** * Fabrique une image informant d'une erreur lors de l'appel au WS. * * @return string Contenu binaire de l'image générée */ public function createPhotoErreur() { return $this->_createImage( " |" . " Une erreur |" . " est |" . " survenue "); } /** * Fabrique une image informant que la photo est introuvable. * Loading Loading
src/UnicaenLeocarte/Controller/IndexController.php +8 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenLeocarte\Controller; use UnicaenLeocarte\Exception\ExtensionNotLoadedException; use UnicaenLeocarte\Exception\NotFoundException; use UnicaenLeocarte\Exception\RuntimeException; use UnicaenLeocarte\Service\Photo\PhotoServiceAwareInterface; use UnicaenLeocarte\Service\Photo\PhotoServiceAwareTrait; use Zend\Http\PhpEnvironment\Response; Loading Loading @@ -50,17 +51,22 @@ class IndexController extends AbstractActionController implements PhotoServiceAw } } } catch (NotFoundException $e) { catch (NotFoundException $nfe) { // Requête infructueuse. // On tente de fabriquer une image informative... try { $content = $this->photoService->createPhotoIntrouvable(); } catch (ExtensionNotLoadedException $e) { catch (ExtensionNotLoadedException $enle) { // Extension 'gd' non installée $content = ''; } } catch (RuntimeException $re) { // Erreur lors de l'appel du WS error_log("Erreur rencontrée lors de l'appel au web service Leocarte : " . $re->getMessage(), 0); $content = $this->photoService->createPhotoErreur(); } /** @var Response $response */ $response = $this->getResponse(); Loading
src/UnicaenLeocarte/Exception/ExtensionNotLoadedException.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace UnicaenLeocarte\Exception; use RuntimeException; class ExtensionNotLoadedException extends RuntimeException { Loading
src/UnicaenLeocarte/Exception/NotFoundException.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace UnicaenLeocarte\Exception; use RuntimeException; class NotFoundException extends RuntimeException { Loading
src/UnicaenLeocarte/Exception/RuntimeException.php 0 → 100644 +8 −0 Original line number Diff line number Diff line <?php namespace UnicaenLeocarte\Exception; class RuntimeException extends \RuntimeException { } No newline at end of file
src/UnicaenLeocarte/Service/Photo/PhotoService.php +14 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,20 @@ class PhotoService implements SoapClientAwareInterface return $imgData; } /** * Fabrique une image informant d'une erreur lors de l'appel au WS. * * @return string Contenu binaire de l'image générée */ public function createPhotoErreur() { return $this->_createImage( " |" . " Une erreur |" . " est |" . " survenue "); } /** * Fabrique une image informant que la photo est introuvable. * Loading