Code Duplication    Length = 19-19 lines in 2 locations

eZ/Publish/Core/Base/Exceptions/NotFoundException.php 1 location

@@ 24-42 (lines=19) @@
21
 * Use:
22
 *   throw new NotFound( 'Content', 42 );
23
 */
24
class NotFoundException extends APINotFoundException implements Httpable, Translatable
25
{
26
    use TranslatableBase;
27
28
    /**
29
     * Generates: Could not find '{$what}' with identifier '{$identifier}'.
30
     *
31
     * @param string $what
32
     * @param mixed $identifier
33
     * @param \Exception|null $previous
34
     */
35
    public function __construct($what, $identifier, Exception $previous = null)
36
    {
37
        $identifierStr = is_string($identifier) ? $identifier : var_export($identifier, true);
38
        $this->setMessageTemplate("Could not find '%what%' with identifier '%identifier%'");
39
        $this->setParameters(['%what%' => $what, '%identifier%' => $identifierStr]);
40
        parent::__construct($this->getBaseTranslation(), self::NOT_FOUND, $previous);
41
    }
42
}
43

eZ/Publish/Core/Base/Exceptions/NotFoundHttpException.php 1 location

@@ 22-40 (lines=19) @@
19
 * Use:
20
 *   throw new NotFoundHttpException( 'Content', 42 );
21
 */
22
class NotFoundHttpException extends SymfonyNotFoundHttpException implements Translatable
23
{
24
    use TranslatableBase;
25
26
    /**
27
     * Generates: Could not find '{$what}' with identifier '{$identifier}'.
28
     *
29
     * @param string $what
30
     * @param mixed $identifier
31
     * @param \Exception|null $previous
32
     */
33
    public function __construct($what, $identifier, Exception $previous = null)
34
    {
35
        $identifierStr = is_string($identifier) ? $identifier : var_export($identifier, true);
36
        $this->setMessageTemplate("Could not find '%what%' with identifier '%identifier%'");
37
        $this->setParameters(['%what%' => $what, '%identifier%' => $identifierStr]);
38
        parent::__construct($this->getBaseTranslation(), $previous);
39
    }
40
}
41