CraigslistQuery::getKeyword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace JobApis\Jobs\Client\Queries;
2
3
class CraigslistQuery extends AbstractQuery
4
{
5
    /**
6
     * location
7
     *
8
     * The search location. Must be one of those supported by Craigslist
9
     *  https://sites.google.com/site/clsiteinfo/city-site-code-sort
10
     *
11
     * @var string
12
     */
13
    protected $location;
14
15
    /**
16
     * format
17
     *
18
     * Format: must be "rss".
19
     *
20
     * @var string
21
     */
22
    protected $format;
23
24
    /**
25
     * query
26
     *
27
     * The search query.
28
     *
29
     * @var string
30
     */
31
    protected $query;
32
33
    /**
34
     * s
35
     *
36
     * Starting result. Always uses 100 per page.
37
     *
38
     * @var integer
39
     */
40
    protected $s;
41
42
    /**
43
     * searchNearby
44
     *
45
     * Should the results include nearby areas
46
     *
47
     * @var boolean
48
     */
49
    protected $searchNearby;
50
51
    /**
52
     * is_internship
53
     *
54
     * @var boolean
55
     */
56
    protected $is_internship;
57
58
    /**
59
     * is_nonprofit
60
     *
61
     * @var boolean
62
     */
63
    protected $is_nonprofit;
64
65
    /**
66
     * is_telecommuting
67
     *
68
     * @var boolean
69
     */
70
    protected $is_telecommuting;
71
72
    /**
73
     * employment_type
74
     *
75
     * Valid options:
76
     *  1: full time
77
     *  2: part time
78
     *  3: contract
79
     *  4: employee's choice
80
     *
81
     * @var integer
82
     */
83
    protected $employment_type;
84
85
    /**
86
     * Get baseUrl
87
     *
88
     * @return  string Value of the base url to this api
89
     */
90 8
    public function getBaseUrl()
91
    {
92 8
        return 'http://'.$this->location.'.craigslist.org/search/jjj';
93
    }
94
95
    /**
96
     * Get keyword
97
     *
98
     * @return  string Attribute being used as the search keyword
99
     */
100 4
    public function getKeyword()
101
    {
102 4
        return $this->query;
103
    }
104
105
    /**
106
     * Default parameters
107
     *
108
     * @return array
109
     */
110 22
    protected function defaultAttributes()
111
    {
112
        return [
113 22
            'format' => 'rss',
114 22
        ];
115
    }
116
117
    /**
118
     * Required parameters
119
     *
120
     * @return array
121
     */
122 6
    protected function requiredAttributes()
123
    {
124
        return [
125 6
            'format',
126 6
            'location',
127 6
        ];
128
    }
129
}
130