Code Duplication    Length = 16-17 lines in 2 locations

src/Charcoal/Attachment/Object/Join.php 1 location

@@ 392-408 (lines=17) @@
389
     * @throws InvalidArgumentException If the position is not an integer (or numeric integer string).
390
     * @return self
391
     */
392
    public function setPosition($position)
393
    {
394
        if ($position === null) {
395
            $this->position = null;
396
            return $this;
397
        }
398
399
        if (!is_numeric($position)) {
400
            throw new InvalidArgumentException(
401
                'Position must be an integer.'
402
            );
403
        }
404
405
        $this->position = (int)$position;
406
407
        return $this;
408
    }
409
410
    /**
411
     * Enable/Disable the relationship.

src/Charcoal/Attachment/Object/Attachment.php 1 location

@@ 699-714 (lines=16) @@
696
     * @throws InvalidArgumentException If provided argument is not of type 'integer' or 'float'.
697
     * @return self
698
     */
699
    public function setFileSize($size)
700
    {
701
        if ($size === null) {
702
            $this->fileSize = null;
703
704
            return $this;
705
        }
706
707
        if (!is_numeric($size)) {
708
            throw new InvalidArgumentException('File size must be an integer or a float.');
709
        }
710
711
        $this->fileSize = $size;
712
713
        return $this;
714
    }
715
716
    /**
717
     * Set file extension.