Code Duplication    Length = 6-8 lines in 5 locations

src/Charcoal/Attachment/Script/CleanupScript.php 1 location

@@ 542-549 (lines=8) @@
539
     */
540
    protected function describeCount($count, $plural, $singular, $zero)
541
    {
542
        if (!is_int($count)) {
543
            throw new InvalidArgumentException(
544
                sprintf(
545
                    'Must be an integer',
546
                    is_object($count) ? get_class($count) : gettype($count)
547
                )
548
            );
549
        }
550
551
        $cli = $this->climate();
552

src/Charcoal/Attachment/Traits/AttachmentAwareTrait.php 2 locations

@@ 97-104 (lines=8) @@
94
        $options = $this->parseAttachmentOptions($options);
95
        extract($options);
96
97
        if ($group !== 0) {
98
            if (!is_string($group)) {
99
                throw new InvalidArgumentException(sprintf(
100
                    'The "group" must be a string, received %s',
101
                    is_object($group) ? get_class($group) : gettype($group)
102
                ));
103
            }
104
        }
105
106
        if ($type !== 0) {
107
            if (!is_string($type)) {
@@ 107-112 (lines=6) @@
104
        }
105
106
        if ($type !== 0) {
107
            if (!is_string($type)) {
108
                throw new InvalidArgumentException(sprintf(
109
                    'The "type" must be a string, received %s',
110
                    is_object($type) ? get_class($type) : gettype($type)
111
                ));
112
            }
113
114
            $type = preg_replace('/([a-z])([A-Z])/', '$1-$2', $type);
115
            $type = strtolower(str_replace('\\', '/', $type));

src/Charcoal/Attachment/Object/Attachment.php 2 locations

@@ 287-293 (lines=7) @@
284
            return $this;
285
        }
286
287
        if (!$obj instanceof AttachmentContainerInterface) {
288
            throw new InvalidArgumentException(sprintf(
289
                'Container object must be an instance of %s; received %s',
290
                AttachmentContainerInterface::class,
291
                (is_object($obj) ? get_class($obj) : gettype($obj))
292
            ));
293
        }
294
295
        if (!$obj->id()) {
296
            throw new InvalidArgumentException(sprintf(
@@ 295-300 (lines=6) @@
292
            ));
293
        }
294
295
        if (!$obj->id()) {
296
            throw new InvalidArgumentException(sprintf(
297
                'Container object must have an ID.',
298
                (is_object($obj) ? get_class($obj) : gettype($obj))
299
            ));
300
        }
301
302
        $this->containerObj = $obj;
303