| Conditions | 4 |
| Paths | 4 |
| Total Lines | 40 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 45 | public function handle() |
||
| 46 | { |
||
| 47 | $keyword = $this->argument('keyword'); |
||
| 48 | |||
| 49 | $channel = Yt::getChannelByName('allocine'); |
||
| 50 | |||
| 51 | if(!empty($channel)) { |
||
| 52 | DB::connection('mongodb')->collection('stats') |
||
| 53 | ->where(['origin' => 'Youtube', 'type' => 'infos'])->delete(); |
||
| 54 | |||
| 55 | $stat = new Stats(); |
||
| 56 | $stat->origin = "Youtube"; |
||
| 57 | $stat->type = "infos"; |
||
| 58 | $stat->data = $channel; |
||
| 59 | $stat->save(); |
||
| 60 | } |
||
| 61 | |||
| 62 | $params = array( |
||
| 63 | 'q' => $keyword, |
||
| 64 | 'type' => 'video', |
||
| 65 | 'part' => 'id, snippet', |
||
| 66 | 'maxResults' => 30 |
||
| 67 | ); |
||
| 68 | |||
| 69 | $videos = Yt::searchAdvanced($params, true)['results']; |
||
| 70 | |||
| 71 | if(!empty($videos)){ |
||
| 72 | |||
| 73 | DB::connection('mongodb')->collection('videos')->delete(); |
||
| 74 | foreach($videos as $video){ |
||
| 75 | $vi = new Videos(); |
||
| 76 | $vi->data = $video; |
||
| 77 | $vi->save(); |
||
| 78 | } |
||
| 79 | } |
||
| 80 | |||
| 81 | Log::info("Import de l'API Youtube video done! "); |
||
| 82 | |||
| 83 | |||
| 84 | } |
||
| 85 | } |
||
| 86 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.