Code Duplication    Length = 10-10 lines in 2 locations

src/ObjectBuilder/Container.php 2 locations

@@ 137-146 (lines=10) @@
134
     *
135
     * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
136
     */
137
    public function factory($callable)
138
    {
139
        if (!method_exists($callable, '__invoke')) {
140
            throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.');
141
        }
142
143
        $this->factories->attach($callable);
144
145
        return $callable;
146
    }
147
148
    /**
149
     * Protects a callable from being interpreted as a service.
@@ 159-168 (lines=10) @@
156
     *
157
     * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object
158
     */
159
    public function protect($callable)
160
    {
161
        if (!method_exists($callable, '__invoke')) {
162
            throw new \InvalidArgumentException('Callable is not a Closure or invokable object.');
163
        }
164
165
        $this->protected->attach($callable);
166
167
        return $callable;
168
    }
169
170
    /**
171
     * Gets a parameter or the closure defining an object.