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 |
|
|
|
|
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) |
|
|
|
|
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
|
|
|
|
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.