1 | <?php namespace JobApis\Jobs\Client\Queries; |
||
3 | class J2cQuery extends AbstractQuery |
||
4 | { |
||
5 | /** |
||
6 | * id |
||
7 | * |
||
8 | * Publisher ID |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $id; |
||
13 | |||
14 | /** |
||
15 | * pass |
||
16 | * |
||
17 | * Publisher Password |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $pass; |
||
22 | |||
23 | /** |
||
24 | * ip |
||
25 | * |
||
26 | * IP Address |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $ip; |
||
31 | |||
32 | /** |
||
33 | * q |
||
34 | * |
||
35 | * Keyword/search query |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $q; |
||
40 | |||
41 | /** |
||
42 | * l |
||
43 | * |
||
44 | * Location |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $l; |
||
49 | |||
50 | /** |
||
51 | * start |
||
52 | * |
||
53 | * Starting result # |
||
54 | * |
||
55 | * @var integer |
||
56 | */ |
||
57 | protected $start; |
||
58 | |||
59 | /** |
||
60 | * limit |
||
61 | * |
||
62 | * Max # of results to return |
||
63 | * |
||
64 | * @var integer |
||
65 | */ |
||
66 | protected $limit; |
||
67 | |||
68 | /** |
||
69 | * sort |
||
70 | * |
||
71 | * Sort by: |
||
72 | * d - by date |
||
73 | * r - by relevance |
||
74 | * |
||
75 | * @var string |
||
76 | */ |
||
77 | protected $sort; |
||
78 | |||
79 | /** |
||
80 | * industry |
||
81 | * |
||
82 | * Industry code to search by |
||
83 | * |
||
84 | * @var string |
||
85 | */ |
||
86 | protected $industry; |
||
87 | |||
88 | /** |
||
89 | * industryEx |
||
90 | * |
||
91 | * Industry code to exclude |
||
92 | * |
||
93 | * @var string |
||
94 | */ |
||
95 | protected $industryEx; |
||
96 | |||
97 | /** |
||
98 | * format |
||
99 | * |
||
100 | * Must be `json` |
||
101 | * |
||
102 | * @var string |
||
103 | */ |
||
104 | protected $format; |
||
105 | |||
106 | /** |
||
107 | * m |
||
108 | * |
||
109 | * Mobile-optimized jobs only |
||
110 | * |
||
111 | * @var boolean |
||
112 | */ |
||
113 | protected $m; |
||
114 | |||
115 | /** |
||
116 | * link |
||
117 | * |
||
118 | * Bypass the JavaScript function to expose a direct link. Default = 0 |
||
119 | * |
||
120 | * @var boolean |
||
121 | */ |
||
122 | protected $link; |
||
123 | |||
124 | /** |
||
125 | * full_desc |
||
126 | * |
||
127 | * Full job description |
||
128 | * |
||
129 | * @var boolean |
||
130 | */ |
||
131 | protected $full_desc; |
||
132 | |||
133 | /** |
||
134 | * jobid |
||
135 | * |
||
136 | * Job ID to search for |
||
137 | * |
||
138 | * @var string |
||
139 | */ |
||
140 | protected $jobid; |
||
141 | |||
142 | /** |
||
143 | * jobtype |
||
144 | * |
||
145 | * Job type to search for |
||
146 | * |
||
147 | * @var string |
||
148 | */ |
||
149 | protected $jobtype; |
||
150 | |||
151 | /** |
||
152 | * d |
||
153 | * |
||
154 | * Radius to search |
||
155 | * |
||
156 | * @var integer |
||
157 | */ |
||
158 | protected $d; |
||
159 | |||
160 | /** |
||
161 | * useragent |
||
162 | * |
||
163 | * Pass in the user agent to prioritize mobile jobs |
||
164 | * |
||
165 | * @var string |
||
166 | */ |
||
167 | protected $useragent; |
||
168 | |||
169 | /** |
||
170 | * Get baseUrl |
||
171 | * |
||
172 | * @return string Value of the base url to this api |
||
173 | */ |
||
174 | 6 | public function getBaseUrl() |
|
178 | |||
179 | /** |
||
180 | * Get keyword |
||
181 | * |
||
182 | * @return string Attribute being used as the search keyword |
||
183 | */ |
||
184 | 4 | public function getKeyword() |
|
188 | |||
189 | /** |
||
190 | * Default parameters |
||
191 | * |
||
192 | * @var array |
||
193 | */ |
||
194 | 20 | protected function defaultAttributes() |
|
201 | |||
202 | /** |
||
203 | * Required parameters |
||
204 | * |
||
205 | * @return array |
||
206 | */ |
||
207 | 6 | protected function requiredAttributes() |
|
216 | |||
217 | /** |
||
218 | * Return the IP address from server |
||
219 | * |
||
220 | * @return string |
||
221 | */ |
||
222 | 20 | protected function userIp() |
|
226 | } |
||
227 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: