Code Duplication    Length = 7-11 lines in 4 locations

src/Command.php 4 locations

@@ 185-195 (lines=11) @@
182
     * @param  ConsoleInterface
183
     * @return mixed
184
     */
185
    public function console(ConsoleInterface $value = null)
186
    {
187
        if (null === $value) {
188
            return $this->console;
189
        }
190
        $this->console = $value;
191
        foreach ($this->commands as $name => $command) {
192
            $command->console = $value;
193
        }
194
        return $this;
195
    }
196
197
    /**
198
     * fs getter and setter.
@@ 223-233 (lines=11) @@
220
     * @param  Tarsana\Command\Interfaces\Template\TemplateLoaderInterface
221
     * @return mixed
222
     */
223
    public function templatesLoader(TemplateLoaderInterface $value = null)
224
    {
225
        if (null === $value) {
226
            return $this->templatesLoader;
227
        }
228
        $this->templatesLoader = $value;
229
        foreach ($this->commands as $name => $command) {
230
            $command->templatesLoader = $value;
231
        }
232
        return $this;
233
    }
234
235
    public function templatesPath(string $path, string $cachePath = null) {
236
        $this->templatesLoader = new TemplateLoader($path, $cachePath);
@@ 235-241 (lines=7) @@
232
        return $this;
233
    }
234
235
    public function templatesPath(string $path, string $cachePath = null) {
236
        $this->templatesLoader = new TemplateLoader($path, $cachePath);
237
        foreach ($this->commands as $name => $command) {
238
            $command->templatesLoader = $this->templatesLoader();
239
        }
240
        return $this;
241
    }
242
243
    public function template(string $name) {
244
        if (null === $this->templatesLoader)
@@ 270-280 (lines=11) @@
267
     * @param  array
268
     * @return mixed
269
     */
270
    public function commands(array $value = null)
271
    {
272
        if (null === $value) {
273
            return $this->commands;
274
        }
275
        $this->commands = [];
276
        foreach ($value as $name => $command) {
277
            $this->command($name, $command);
278
        }
279
        return $this;
280
    }
281
282
    public function command(string $name, Command $command = null)
283
    {