IeeeQuery::getQueryAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php namespace JobApis\Jobs\Client\Queries;
2
3
class IeeeQuery extends AbstractQuery
4
{
5
    /**
6
     * keyword
7
     *
8
     * The search string.
9
     *
10
     * @var string
11
     */
12
    protected $keyword;
13
14
    /**
15
     * location
16
     *
17
     * The search location.
18
     *
19
     * @var string
20
     */
21
    protected $location;
22
23
    /**
24
     * rows
25
     *
26
     * Results per page. Should be one of the following:
27
     * - 15
28
     * - 25
29
     * - 50
30
     *
31
     * @var integer
32
     */
33
    protected $rows;
34
35
    /**
36
     * page
37
     *
38
     * @var integer
39
     */
40
    protected $page;
41
42
    /**
43
     * radius
44
     *
45
     * Miles away to search (up to 150).
46
     *
47
     * @var integer
48
     */
49
    protected $radius;
50
51
    /**
52
     * kwsJobTitleOnly
53
     *
54
     * Search keywords apply to job title only.
55
     *
56
     * @var boolean
57
     */
58
    protected $kwsJobTitleOnly;
59
60
    /**
61
     * category
62
     *
63
     * Array of categories to search (eg: `category[0]=computer_engineering`).
64
     *
65
     * @var array
66
     */
67
    protected $category;
68
69
    /**
70
     * sort
71
     *
72
     * Order and order by fields combined (eg: `sort=score+desc`).
73
     *
74
     * @var string
75
     */
76
    protected $sort;
77
78
    /**
79
     * region
80
     *
81
     * Valid options include:
82
     *  us_central
83
     *  us_e
84
     *  us_ne
85
     *  us_se
86
     *  us_sw
87
     *  us_w
88
     *  africa
89
     *  australia_and_oceania
90
     *  ca
91
     *  europe_e
92
     *  europe_w
93
     *  asia_e_and_se
94
     *  europe
95
     *  latin_america
96
     *  middle_e
97
     *  asia_sc
98
     *
99
     * @var string
100
     */
101
    protected $region;
102
103
    /**
104
     * SearchNetworks
105
     *
106
     * Networks to search (eg: `US`).
107
     *
108
     * @var string
109
     */
110
    protected $SearchNetworks;
111
112
    /**
113
     * networkView
114
     *
115
     * Network view (eg: `national`)
116
     *
117
     * @var string
118
     */
119
    protected $networkView;
120
121
    /**
122
     * format
123
     *
124
     * Format of results. Should default to `json`.
125
     *
126
     * @var string
127
     */
128
    protected $format;
129
130
    /**
131
     * Get baseUrl
132
     *
133
     * @return  string Value of the base url to this api
134
     */
135 6
    public function getBaseUrl()
136
    {
137 6
        return 'http://jobs.ieee.org/jobs/results';
138
    }
139
140
    /**
141
     * Get keyword
142
     *
143
     * @return  string Attribute being used as the search keyword
144
     */
145 6
    public function getKeyword()
146
    {
147 6
        return $this->keyword;
148
    }
149
150
    /**
151
     * Get url
152
     *
153
     * @return  string
154
     */
155 4
    public function getUrl()
156
    {
157 4
        return $this->getBaseUrl().'/keyword/'.$this->keyword.$this->getQueryString();
158
    }
159
160
    /**
161
     * Gets the attributes to use for this API's query
162
     *
163
     * @var array
164
     */
165 4
    protected function getQueryAttributes()
166
    {
167 4
        $attributes = get_object_vars($this);
168 4
        unset($attributes['keyword']);
169 4
        return $attributes;
170
    }
171
172
    /**
173
     * Required parameters
174
     *
175
     * @return array
176
     */
177 18
    protected function defaultAttributes()
178
    {
179
        return [
180 18
            'format' => 'json',
181 18
        ];
182
    }
183
184
    /**
185
     * Required parameters
186
     *
187
     * @return array
188
     */
189 6
    protected function requiredAttributes()
190
    {
191
        return [
192 6
            'keyword',
193 6
            'format',
194 6
        ];
195
    }
196
}
197