Code Duplication    Length = 7-11 lines in 4 locations

src/Command.php 4 locations

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