GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (114)

src/elevate/util/InfoHelper.php (10 issues)

1
<?php
2
/**
3
 * Created by JetBrains PhpStorm.
4
 * User: ofields
5
 * Date: 11/8/13
6
 * Time: 12:12 PM
7
 * To change this template use File | Settings | File Templates.
8
 */
9
10
namespace elevate\util;
11
12
13
use elevate\HVObjects\MethodObjects\Get\Info;
14
use elevate\HVObjects\MethodObjects\PersonInfo\HVGroup;
15
use elevate\HVObjects\MethodObjects\Get\RequestGroup;
16
use elevate\HVObjects\MethodObjects\ThingFilterSpec;
17
use elevate\HVObjects\MethodObjects\ThingFormatSpec;
18
use elevate\TypeTranslator;
19
use Mentis\BaseBundle\Services\DateTimeHelper;
20
21
/**
22
 * Class InfoHelper
23
 * @package elevate\util
24
 */
25
class InfoHelper {
26
27
    /**
28
     * TODO Make me return keys as numbers not IDs! See ResponseGroupParser
29
     *
30
     * @param array $ids
31
     * @param null  $groupName
32
     *
33
     * @return Info
34
     */
35
    static function getHvInfoForThingIds(array $ids, $groupName = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHvInfoForThingIds.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
36
    {
37
        return new Info(array(self::getHVRequestGroupForIds($ids, $groupName)));
38
    }
39
40
    /**
41
     * @param      $thingName
42
     * @param int  $maxItems
43
     * @param null $groupName
44
     * @param null $xpath
45
     *
46
     * @return Info
47
     */
48
    static function getHVInfoForThingName($thingName, $maxItems = 1, $groupName = null, $xpath = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVInfoForThingName.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
49
    {
50
        $typeId = TypeTranslator::lookupTypeId($thingName);
51
        $group = self::getHVRequestGroupForTypeId($typeId, $maxItems, $groupName, $xpath);
52
        $info = new Info(array($group));
53
        return $info;
54
    }
55
56
    /**
57
     * @param      $typeId
58
     * @param int  $maxItems
59
     * @param null $groupName
60
     * @param null $xpath
61
     *
62
     * @return Info
63
     */
64
    static function getHVInfoForTypeId($typeId, $maxItems = 1, $groupName = null, $xpath = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVInfoForTypeId.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
65
    {
66
        $group = self::getHVRequestGroupForTypeId($typeId, $maxItems, $groupName, $xpath);
67
        $info = new Info(array($group));
68
        return $info;
69
    }
70
71
    /**
72
     * @param      $typeId
73
     * @param int  $maxItems
74
     * @param null $groupName
75
     * @param null $xpath
76
     * @param null $startRangeDate
77
     * @param null $endRangeDate
78
     * @param null $updatedDateMin
79
     * @param null $updatedDateMax
80
     *
81
     * @return RequestGroup
82
     */
83
    static function getHVRequestGroupForTypeId($typeId, $maxItems = 1, $groupName = null, $xpath = null, $startRangeDate = null, $endRangeDate = null, $updatedDateMin = null, $updatedDateMax = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForTypeId.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
84
    {
85
        $filter = new ThingFilterSpec($typeId, $xpath, $startRangeDate, $endRangeDate, null, $updatedDateMin, $updatedDateMax);
86
        $format = new ThingFormatSpec(array('core'));
87
88
        $group = new RequestGroup($filter, $format, $maxItems, $maxItems, $groupName);
89
        return $group;
90
    }
91
92
    static function getHVRequestGroupForThingName($thingName, $maxItems = 1, $groupName = null, $xpath = null, $startRangeDate = null, $endRangeDate = null, $updatedDateMin = null, $updatedDateMax = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForThingName.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
93
    {
94
        $typeId = TypeTranslator::lookupTypeId($thingName);
95
        return self::getHVRequestGroupForTypeId($typeId, $maxItems, $groupName, $xpath, $startRangeDate, $endRangeDate, null, $updatedDateMin, $updatedDateMax);
96
    }
97
98
    /**
99
     * @param      $thingName
100
     * @param      $startDate
101
     * @param      $endDate
102
     * @param      $updatedDateMin
103
     * @param      $updatedDateMax
104
     * @param int  $maxItems
105
     * @param null $groupName
106
     * @param null $xpath
107
     *
108
     * @return RequestGroup
109
     */
110
    static function getHVRequestGroupForThingBetweenDates($thingName, $startDate, $endDate, $maxItems = 1, $groupName = null, $xpath = null, $createdPersonId = NULL, $updatedDateMin = null, $updatedDateMax = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForThingBetweenDates.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
111
    {
112
        $typeId = TypeTranslator::lookupTypeId($thingName);
113
114
        $formattedStartDate = $formattedEndDate = null;
115
        $formattedUpdatedDateMin = $formattedUpdatedDateMax = null;
116
117
        if ( !empty($startDate) )
118
        {
119
            $formattedStartDate = DateTimeHelper::convertToGMT(date("c", strtotime($startDate)));
120
        }
121
        if ( !empty($endDate) )
122
        {
123
            $formattedEndDate = DateTimeHelper::convertToGMT(date("c", strtotime($endDate)));
124
        }
125
        if ( !empty($updatedDateMin) )
126
        {
127
            $formattedUpdatedDateMin = DateTimeHelper::convertToGMT(date("c", strtotime($updatedDateMin)));
128
        }
129
        if ( !empty($updatedDateMax) )
130
        {
131
            $formattedUpdatedDateMax = DateTimeHelper::convertToGMT(date("c", strtotime($updatedDateMax)));
132
        }
133
134
        $filter = new ThingFilterSpec($typeId, $xpath, $formattedStartDate, $formattedEndDate, $createdPersonId, $formattedUpdatedDateMin, $formattedUpdatedDateMax);
135
        $format = new ThingFormatSpec(array('core'));
136
137
        return new RequestGroup($filter, $format, $maxItems, $maxItems, $groupName);
138
    }
139
140
    /**
141
     * @param array $ids
142
     * @param null  $groupName
143
     *
144
     * @return RequestGroup
145
     */
146
    static function getHVRequestGroupForIds(array $ids, $groupName = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForIds.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
147
    {
148
        $group = new RequestGroup();
149
150
        $format = new ThingFormatSpec(array('core'));
151
        $filter = new ThingFilterSpec();
152
153
        $group->setCurrentVersionOnly(false);
154
        $group->setFormat($format);
155
        $group->setFilter($filter);
156
        $group->setIds($ids);
157
        $group->setMax(count($ids));
158
        $group->setName($groupName);
159
        return $group;
160
    }
161
162
    /**
163
     * @param array $clientIds
164
     * @param null  $groupName
165
     *
166
     * @return RequestGroup
167
     */
168
    static function getHVRequestGroupForClientIds(array $clientIds, $groupName = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForClientIds.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
169
    {
170
        $group = new RequestGroup();
171
172
        $format = new ThingFormatSpec(array('core'));
173
        $filter = new ThingFilterSpec();
174
175
        $group->setCurrentVersionOnly(false);
176
        $group->setFormat($format);
177
        $group->setFilter($filter);
178
        $group->setClientThingIds($clientIds);
179
        $group->setMax(count($clientIds));
180
        $group->setName($groupName);
181
        return $group;
182
    }
183
184
    /**
185
     * @param      $thingName
186
     * @param int  $maxItems
187
     * @param null $groupName
188
     * @param null $xpath
189
     * @param null $startRangeDate
190
     * @param null $endRangeDate
191
     * @param null $updatedDateMin
192
     * @param null $updatedDateMax
193
     *
194
     * @return RequestGroup
195
     */
196
    static function getHVRequestGroupForBase64ThingName($thingName, $maxItems = 1, $groupName = null, $xpath = null, $startRangeDate = null, $endRangeDate = null, $updatedDateMin = null, $updatedDateMax = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForBase64ThingName.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
197
    {
198
        $typeId = TypeTranslator::lookupTypeId($thingName);
199
        return self::getHVRequestGroupForBase64TypeId($typeId, $maxItems, $groupName, $xpath, $startRangeDate, $endRangeDate, $updatedDateMin, $updatedDateMax);
200
    }
201
202
    /**
203
     * @param      $typeId
204
     * @param int  $maxItems
205
     * @param null $groupName
206
     * @param null $xpath
207
     * @param null $startRangeDate
208
     * @param null $endRangeDate
209
     * @param null $updatedDateMin
210
     * @param null $updatedDateMax
211
     *
212
     * @return RequestGroup
213
     */
214
    static function getHVRequestGroupForBase64TypeId($typeId, $maxItems = 1, $groupName = null, $xpath = null, $startRangeDate = null, $endRangeDate = null, $updatedDateMin = null, $updatedDateMax = null)
0 ignored issues
show
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for getHVRequestGroupForBase64TypeId.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
215
    {
216
        $filter = new ThingFilterSpec($typeId, $xpath, $startRangeDate, $endRangeDate, null, $updatedDateMin, $updatedDateMax);
217
        $format = new ThingFormatSpec(array('otherdata'));
218
219
        $group = new RequestGroup($filter, $format, $maxItems, $maxItems, $groupName);
220
        return $group;
221
    }
222
223
}