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

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