@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Makes a best guess at the server's IP defaulting to localhost. |
5 | 5 | */ |
6 | -if (isset($_SERVER['REMOTE_ADDR'])) { |
|
7 | - $currentIp = $_SERVER['REMOTE_ADDR']; |
|
8 | -} elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { |
|
9 | - $ipAddresses = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
6 | +if (isset($_SERVER[ 'REMOTE_ADDR' ])) { |
|
7 | + $currentIp = $_SERVER[ 'REMOTE_ADDR' ]; |
|
8 | +} elseif (isset($_SERVER[ "HTTP_X_FORWARDED_FOR" ])) { |
|
9 | + $ipAddresses = explode(',', $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]); |
|
10 | 10 | $currentIp = trim(end($ipAddresses)); |
11 | 11 | } else { |
12 | 12 | $currentIp = '127.0.0.1'; |
@@ -15,17 +15,16 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Makes a best guess at the user agent making this request |
17 | 17 | */ |
18 | -$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : |
|
19 | - 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'; |
|
18 | +$userAgent = isset($_SERVER[ 'HTTP_USER_AGENT' ]) ? $_SERVER[ 'HTTP_USER_AGENT' ] : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'; |
|
20 | 19 | |
21 | 20 | /** |
22 | 21 | * Default job boards that require no API key permissions |
23 | 22 | */ |
24 | 23 | $jobboards = [ |
25 | - 'Careercast' => [], |
|
26 | - 'Dice' => [], |
|
27 | - 'Github' => [], |
|
28 | - 'Govt' => [], |
|
24 | + 'Careercast' => [ ], |
|
25 | + 'Dice' => [ ], |
|
26 | + 'Github' => [ ], |
|
27 | + 'Govt' => [ ], |
|
29 | 28 | ]; |
30 | 29 | |
31 | 30 | /** |
@@ -33,7 +32,7 @@ discard block |
||
33 | 32 | * http://developer.careerbuilder.com/ |
34 | 33 | */ |
35 | 34 | if (env("CAREERBUILDER_KEY")) { |
36 | - $jobboards['Careerbuilder'] = [ |
|
35 | + $jobboards[ 'Careerbuilder' ] = [ |
|
37 | 36 | 'DeveloperKey' => env("CAREERBUILDER_KEY"), |
38 | 37 | ]; |
39 | 38 | } |
@@ -42,7 +41,7 @@ discard block |
||
42 | 41 | * http://www.indeed.com/publisher |
43 | 42 | */ |
44 | 43 | if (env("INDEED_KEY")) { |
45 | - $jobboards['Indeed'] = [ |
|
44 | + $jobboards[ 'Indeed' ] = [ |
|
46 | 45 | 'publisher' => env("INDEED_KEY"), |
47 | 46 | 'userip' => $currentIp, |
48 | 47 | 'useragent' => $userAgent, |
@@ -53,7 +52,7 @@ discard block |
||
53 | 52 | * https://developer.usajobs.gov/Search-API/Overview |
54 | 53 | */ |
55 | 54 | if (env("USAJOBS_KEY")) { |
56 | - $jobboards['Usajobs'] = [ |
|
55 | + $jobboards[ 'Usajobs' ] = [ |
|
57 | 56 | 'AuthorizationKey' => env("USAJOBS_KEY"), |
58 | 57 | ]; |
59 | 58 | } |
@@ -62,7 +61,7 @@ discard block |
||
62 | 61 | * http://www.juju.com/publisher/spec/ |
63 | 62 | */ |
64 | 63 | if (env("JUJU_KEY")) { |
65 | - $jobboards['Juju'] = [ |
|
64 | + $jobboards[ 'Juju' ] = [ |
|
66 | 65 | 'partnerid' => env("JUJU_KEY"), |
67 | 66 | 'ipaddress' => $currentIp, |
68 | 67 | 'useragent' => $userAgent, |
@@ -74,7 +73,7 @@ discard block |
||
74 | 73 | * https://www.ziprecruiter.com/publishers |
75 | 74 | */ |
76 | 75 | if (env("ZIPRECRUITER_KEY")) { |
77 | - $jobboards['Ziprecruiter'] = [ |
|
76 | + $jobboards[ 'Ziprecruiter' ] = [ |
|
78 | 77 | 'api_key' => env("ZIPRECRUITER_KEY"), |
79 | 78 | ]; |
80 | 79 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | */ |
8 | 8 | |
9 | -$factory->define(\JobApis\JobsToMail\Models\Token::class, function (Faker\Generator $faker) { |
|
9 | +$factory->define(\JobApis\JobsToMail\Models\Token::class, function(Faker\Generator $faker) { |
|
10 | 10 | return [ |
11 | 11 | 'user_id' => null, |
12 | 12 | 'type' => 'confirm', |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | */ |
8 | 8 | |
9 | -$factory->define(\JobApis\JobsToMail\Models\User::class, function (Faker\Generator $faker) { |
|
9 | +$factory->define(\JobApis\JobsToMail\Models\User::class, function(Faker\Generator $faker) { |
|
10 | 10 | return [ |
11 | 11 | 'email' => $faker->safeEmail(), |
12 | 12 | 'keyword' => $faker->word(), |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | 'confirmed_at' => null, |
15 | 15 | ]; |
16 | 16 | }); |
17 | -$factory->state(\JobApis\JobsToMail\Models\User::class, 'active', function (Faker\Generator $faker) { |
|
17 | +$factory->state(\JobApis\JobsToMail\Models\User::class, 'active', function(Faker\Generator $faker) { |
|
18 | 18 | return [ |
19 | 19 | 'confirmed_at' => $faker->dateTimeThisYear(), |
20 | 20 | ]; |
21 | 21 | }); |
22 | -$factory->state(\JobApis\JobsToMail\Models\User::class, 'deleted', function (Faker\Generator $faker) { |
|
22 | +$factory->state(\JobApis\JobsToMail\Models\User::class, 'deleted', function(Faker\Generator $faker) { |
|
23 | 23 | return [ |
24 | 24 | 'deleted_at' => $faker->dateTimeThisYear(), |
25 | 25 | ]; |
@@ -2,11 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use Illuminate\Console\Command; |
4 | 4 | use Illuminate\Foundation\Bus\DispatchesJobs; |
5 | -use JobApis\JobsToMail\Jobs\CollectJobsForUser; |
|
6 | 5 | use JobApis\JobsToMail\Jobs\SearchAndNotifyUser; |
7 | 6 | use JobApis\JobsToMail\Repositories\Contracts\SearchRepositoryInterface; |
8 | -use JobApis\JobsToMail\Repositories\SearchRepository; |
|
9 | -use JobApis\JobsToMail\Repositories\UserRepository; |
|
10 | 7 | |
11 | 8 | class EmailJobs extends Command |
12 | 9 | { |
@@ -100,7 +100,6 @@ |
||
100 | 100 | /** |
101 | 101 | * Logs all the errors attached to a collection |
102 | 102 | * |
103 | - * @param array $jobsByProvider |
|
104 | 103 | * |
105 | 104 | * @return void |
106 | 105 | */ |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php namespace JobApis\JobsToMail\Jobs; |
2 | 2 | |
3 | 3 | use Illuminate\Bus\Queueable; |
4 | -use Illuminate\Queue\SerializesModels; |
|
5 | -use Illuminate\Queue\InteractsWithQueue; |
|
6 | 4 | use Illuminate\Contracts\Queue\ShouldQueue; |
5 | +use Illuminate\Queue\InteractsWithQueue; |
|
6 | +use Illuminate\Queue\SerializesModels; |
|
7 | 7 | use Illuminate\Support\Facades\Log; |
8 | -use JobApis\Jobs\Client\Collection; |
|
9 | -use JobApis\Jobs\Client\JobsMulti; |
|
10 | 8 | use JobApis\JobsToMail\Models\User; |
11 | 9 | use JobApis\JobsToMail\Notifications\JobsCollected; |
10 | +use JobApis\Jobs\Client\Collection; |
|
11 | +use JobApis\Jobs\Client\JobsMulti; |
|
12 | 12 | |
13 | 13 | class CollectJobsForUser implements ShouldQueue |
14 | 14 | { |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - protected function getJobsFromCollections($collectionsArray = []) |
|
80 | + protected function getJobsFromCollections($collectionsArray = [ ]) |
|
81 | 81 | { |
82 | - $jobs = []; |
|
82 | + $jobs = [ ]; |
|
83 | 83 | array_walk_recursive( |
84 | 84 | $collectionsArray, |
85 | - function (Collection $collection) use (&$jobs) { |
|
85 | + function(Collection $collection) use (&$jobs) { |
|
86 | 86 | $this->logErrorsFromCollection($collection); |
87 | 87 | $jobListings = array_slice( |
88 | 88 | $collection->all(), |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | self::MAX_JOBS_FROM_PROVIDER |
91 | 91 | ); |
92 | 92 | foreach ($jobListings as $jobListing) { |
93 | - $jobs[] = $jobListing; |
|
93 | + $jobs[ ] = $jobListing; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | ); |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return array |
122 | 122 | */ |
123 | - protected function sortJobs($jobs = []) |
|
123 | + protected function sortJobs($jobs = [ ]) |
|
124 | 124 | { |
125 | 125 | // Sort by date |
126 | - usort($jobs, function ($item1, $item2) { |
|
126 | + usort($jobs, function($item1, $item2) { |
|
127 | 127 | return $item2->datePosted <=> $item1->datePosted; |
128 | 128 | }); |
129 | 129 | // Filter any older than max age |
130 | - $jobs = array_filter($jobs, function ($job) { |
|
130 | + $jobs = array_filter($jobs, function($job) { |
|
131 | 131 | return $job->datePosted > new \DateTime(self::MAX_DAYS_OLD.' days ago'); |
132 | 132 | }); |
133 | 133 | // Truncate to the max number of results |
@@ -12,7 +12,6 @@ |
||
12 | 12 | /** |
13 | 13 | * SearchRepository constructor. |
14 | 14 | * |
15 | - * @param Search $model |
|
16 | 15 | */ |
17 | 16 | public function __construct(Search $searches) |
18 | 17 | { |
@@ -27,10 +27,10 @@ |
||
27 | 27 | * |
28 | 28 | * @return Search |
29 | 29 | */ |
30 | - public function create($userId = null, $data = []) |
|
30 | + public function create($userId = null, $data = [ ]) |
|
31 | 31 | { |
32 | 32 | return $this->searches->create( |
33 | - array_merge(['user_id' => $userId], $data) |
|
33 | + array_merge([ 'user_id' => $userId ], $data) |
|
34 | 34 | ); |
35 | 35 | } |
36 | 36 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -use Illuminate\Support\Facades\Schema; |
|
4 | -use Illuminate\Database\Schema\Blueprint; |
|
5 | 3 | use Illuminate\Database\Migrations\Migration; |
4 | +use Illuminate\Database\Schema\Blueprint; |
|
5 | +use Illuminate\Support\Facades\Schema; |
|
6 | 6 | |
7 | 7 | class CreateTokensTable extends Migration |
8 | 8 | { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('searches', function (Blueprint $table) { |
|
16 | + Schema::create('searches', function(Blueprint $table) { |
|
17 | 17 | $table->uuid('id'); |
18 | 18 | $table->primary('id'); |
19 | 19 | $table->uuid('user_id')->unsigned(); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Create a new job instance. |
17 | 17 | */ |
18 | - public function __construct($data = []) |
|
18 | + public function __construct($data = [ ]) |
|
19 | 19 | { |
20 | 20 | $this->data = $data; |
21 | 21 | } |
@@ -4,11 +4,11 @@ |
||
4 | 4 | { |
5 | 5 | public function confirm($token = null); |
6 | 6 | |
7 | - public function create($data = []); |
|
7 | + public function create($data = [ ]); |
|
8 | 8 | |
9 | - public function firstOrCreate($data = []); |
|
9 | + public function firstOrCreate($data = [ ]); |
|
10 | 10 | |
11 | - public function getById($id = null, $options = []); |
|
11 | + public function getById($id = null, $options = [ ]); |
|
12 | 12 | |
13 | - public function update($id = null, $data = []); |
|
13 | + public function update($id = null, $data = [ ]); |
|
14 | 14 | } |