Code Duplication    Length = 13-14 lines in 2 locations

src/Entity/Descriptor.php 2 locations

@@ 75-87 (lines=13) @@
72
     * @return $this
73
     * @throws \Exception
74
     */
75
    public function addScope($scope)
76
    {
77
        if (!$this->validateScopeValue($scope)) {
78
            throw new \InvalidArgumentException(sprintf("Unknown scope %s", $scope));
79
        }
80
81
        if (in_array($scope, $this->descriptor['scopes'])) {
82
            return $this;
83
        }
84
85
        $this->descriptor['scopes'][] = $scope;
86
        return $this;
87
    }
88
89
    /**
90
     * @param string $scope
@@ 116-129 (lines=14) @@
113
     * @return $this
114
     * @throws \Exception
115
     */
116
    public function removeScope($scope)
117
    {
118
        if (!$this->validateScopeValue($scope)) {
119
            throw new \InvalidArgumentException(sprintf("Unknown scope %s", $scope));
120
        }
121
122
        $key = array_search($scope, $this->descriptor['scopes']);
123
        if (false === $key) {
124
            return $this;
125
        }
126
127
        unset($this->descriptor['scopes'][$key]);
128
        return $this;
129
    }
130
131
    /**
132
     * @return array