CountryTableSeeder::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 7
cp 0
crap 2
rs 9.9666
c 0
b 0
f 0
1
<?php
2
namespace agoalofalife\database\seeds;
3
use \Illuminate\Database\Capsule\Manager as Capsule;
4
use Illuminate\Database\Seeder;
5
6
7
class CountryTableSeeder extends Seeder
8
{
9
    /**
10
     * Auto generated seed file.
11
     *
12
     * @return void
13
     */
14
    public function run()
15
    {
16
          $body = file_get_contents('https://api.vk.com/method/database.getCountries?v=5.5&need_all=1&count=1000&lang='.
17
                      config('geography.locale') . '&code=' .  config('geography.country') . '&access_token=' .
18
                      config('geography.access_token'));
19
          $response  = json_decode($body, true);
20
21
          Capsule::table( config('geography.nameTable.country') )->insert( $response['response']['items'] );
22
    }
23
}
24