Completed
Push — master ( 3e6d98...08a8d6 )
by Ricardo
04:32
created

IcsReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 77
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 77
loc 77
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fire() 4 4 1
A handle() 42 42 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Finder\Console\Commands\Readers;
4
5
use File;
6
use Illuminate\Console\Command;
7
use Illuminate\Filesystem\Filesystem;
8
use Illuminate\View\Compilers\BladeCompiler;
9
use DirectoryIterator;
10
use Finder\Spider\Registrator\PhotoRegistrator;
11
use Muleta\Utils\Extratores\FileExtractor;
12
use Support\Components\Coders\Parser\ParseClass;
13
use Finder\Readers\iCalEasyReader;
14
15 View Code Duplication
class IcsReader extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
18
    /**
19
     * The console command name.
20
     *
21
     * @var string
22
     */
23
    protected $name = 'reader:ics';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = ' aa';
31
32
    /**
33
     * Call fire function
34
     *
35
     * @return void
36
     */
37
    public function fire(Filesystem $filesystem)
38
    {
39
        return $this->handle($filesystem);
40
    }
41
42
    /**
43
     * Execute the console command.
44
     *
45
     * @param \Illuminate\Filesystem\Filesystem $filesystem
46
     *
47
     * @return void
48
     */
49
    public function handle(Filesystem $filesystem)
0 ignored issues
show
Unused Code introduced by
The parameter $filesystem is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        $ical = new iCalEasyReader();
52
        \Log::warning(
53
            storage_path( 'app/import/agenda-pessoal.ics' )
54
        );
55
        $lines = $ical->load( storage_path( 'app/import/agenda-pessoal.ics' ) );
56
        dd( $lines );
57
        
58
59
        // // Import Data Files
60
        // $dir_path = storage_path('data');
61
        // $dir = new DirectoryIterator($dir_path);
62
        // foreach ($dir as $fileinfo) {
63
        //     dd($fileinfo, $fileinfo->isDot());
64
        //     if (!$fileinfo->isDot()) {
65
        
66
        //     }
67
        //     else {
68
        
69
        //     }
70
        // }
71
        
72
        // $dir_path = storage_path('midia');
73
        // collect($filesystem->directories($dir_path))->map(
74
        //     function ($item) use ($filesystem) {
75
        //         $person = $this->getFileName($item);
76
        //         collect($filesystem->allFiles($item))->map(
77
        //             function ($file) use ($filesystem, $person) {
78
        //                   $registrator = new PhotoRegistrator($file);
79
        //                   $registrator->havePerson($person);
80
        //                   dd($file, $registrator);
81
        //             }
82
        //         );
83
        //     }
84
        // );
85
86
        // // (new \Finder\Routines\Globals\BackupAll)->run();
87
        // (new \Finder\Routines\Globals\ImportTokens)->run();
88
        
89
        // (new \Finder\Routines\Globals\SpiderAllDomains)->run();
90
    }
91
}
92