Code Duplication    Length = 10-14 lines in 3 locations

core/services/container/CoffeeShop.php 1 location

@@ 422-431 (lines=10) @@
419
     * @return string
420
     * @throws InvalidIdentifierException
421
     */
422
    private function processIdentifier($identifier)
423
    {
424
        if ( ! is_string($identifier)) {
425
            throw new InvalidIdentifierException(
426
                is_object($identifier) ? get_class($identifier) : gettype($identifier),
427
                '\Fully\Qualified\ClassName'
428
            );
429
        }
430
        return ltrim($identifier, '\\');
431
    }
432
433
434

core/services/container/Recipe.php 1 location

@@ 197-206 (lines=10) @@
194
     * @param  string $identifier Identifier for the entity class that the Recipe applies to
195
     *                            Typically a Fully Qualified Class Name
196
     */
197
    public function setIdentifier($identifier)
198
    {
199
        if ( ! is_string($identifier) || empty($identifier)) {
200
            throw new InvalidIdentifierException(
201
                is_object($identifier) ? get_class($identifier) : gettype($identifier),
202
                __('class identifier (typically a \Fully\Qualified\ClassName)', 'event_espresso')
203
            );
204
        }
205
        $this->identifier = $identifier;
206
    }
207
208
209

core/services/container/CoffeeMaker.php 1 location

@@ 74-87 (lines=14) @@
71
    /**
72
     * @param $type
73
     */
74
    public static function validateType($type)
75
    {
76
        $types = CoffeeMaker::getTypes();
77
        if ( ! in_array($type, $types)) {
78
            throw new InvalidIdentifierException(
79
                is_object($type) ? get_class($type) : gettype($type),
80
                __(
81
                    'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)',
82
                    'event_espresso'
83
                )
84
            );
85
        }
86
        return $type;
87
    }
88
89
90