Skip to content

Commit ed22aa6

Browse files
committed
Merge pull request #435 from rackspace/working
Merging working -> master in preparation for minor release
2 parents 0b95f51 + 7b88926 commit ed22aa6

File tree

159 files changed

+169
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+169
-275
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ branches:
1717

1818
before_script:
1919
- composer install --prefer-source
20+
- vendor/bin/parallel-lint --exclude vendor .
21+
- vendor/bin/php-cs-fixer fix --dry-run --level psr2 .
2022

2123
after_script:
2224
- php vendor/bin/coveralls -v

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ efforts. Here are a few general guidelines to follow:
1111
will need to write new test cases; if you're updating existing code, you will
1212
need to make sure the methods you're updating are still completely covered.
1313

14-
3. Please abide by PSR code styling.
14+
3. Please abide by [PSR-2 code styling](#ensuring-psr-2-coding-style-compliance).
1515

1616
4. Explaining your pull requests is appreciated. Unless you're fixing a
1717
minor typographical error, create a description which explains your changes
@@ -44,3 +44,11 @@ phpunit
4444
* Methods that create a new resource, say `Foo`, should be named `createFoo`. For example, [`createEntity`](/lib/OpenCloud/CloudMonitoring/Service.php#L105).
4545

4646
* When validating arguments to a method, please throw `\InvalidArgumentException` when an invalid argument is found. For example, see [here](/lib/OpenCloud/LoadBalancer/Resource/LoadBalancer.php#L212-L215).
47+
48+
## Ensuring PSR-2 coding style compliance
49+
50+
The code in this library is compliant with the [PSR-2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). To ensure that any code you contribute is also PSR-2 compliant, please run the following command from the base directory of this project _before_ submitting your contribution:
51+
52+
$ vendor/bin/php-cs-fixer fix --level psr2 .
53+
54+
Running this command will _change_ your code to become PSR-2 compliant. You will need to _commit_ these changes and make them part of your pull request.

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
},
2828
"require-dev" : {
2929
"guzzle/guzzle": "~3.8",
30-
"satooshi/php-coveralls": "0.6.*@dev"
30+
"satooshi/php-coveralls": "0.6.*@dev",
31+
"jakub-onderka/php-parallel-lint": "0.*",
32+
"fabpot/php-cs-fixer": "1.0.*@dev"
3133
}
3234
}

lib/OpenCloud/Autoscale/Resource/LaunchConfiguration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
*/
3939
class LaunchConfiguration extends AbstractResource
4040
{
41-
4241
public $type;
4342
public $args;
4443

lib/OpenCloud/CloudMonitoring/Collection/MonitoringIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ public function parseResponseBody($body)
3232

3333
return $parsed;
3434
}
35-
}
35+
}

lib/OpenCloud/CloudMonitoring/Resource/Agent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ public function getAgentHost()
8989
{
9090
return $this->getService()->resource('AgentHost', null, $this);
9191
}
92-
}
92+
}

lib/OpenCloud/CloudMonitoring/Resource/AgentHost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ public function info($type)
5757
'resourceClass' => 'AgentHostInfo'
5858
));
5959
}
60-
}
60+
}

lib/OpenCloud/CloudMonitoring/Resource/AgentTarget.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525
class AgentTarget extends ReadOnlyResource
2626
{
27-
2827
private $type = 'agent.filesystem';
2928

3029
protected static $json_name = 'targets';

lib/OpenCloud/CloudMonitoring/Resource/ReadOnlyResource.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525
class ReadOnlyResource extends AbstractResource
2626
{
27-
2827
public function create($params = array())
2928
{
3029
return $this->noCreate();

lib/OpenCloud/Common/Base.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ protected function setProperty($property, $value)
110110
if (method_exists($this, $setter)) {
111111
return call_user_func(array($this, $setter), $value);
112112
} elseif (false !== ($propertyVal = $this->propertyExists($property))) {
113-
114113
// Are we setting a public or private property?
115114
if ($this->isAccessible($propertyVal)) {
116115
$this->$propertyVal = $value;
@@ -120,7 +119,6 @@ protected function setProperty($property, $value)
120119

121120
return $this;
122121
} else {
123-
124122
$this->getLogger()->warning(
125123
'Attempted to set {property} with value {value}, but the'
126124
. ' property has not been defined. Please define first.',
@@ -284,15 +282,11 @@ public function url($path = null, array $query = array())
284282
public function populate($info, $setObjects = true)
285283
{
286284
if (is_string($info) || is_integer($info)) {
287-
288285
$this->setProperty($this->primaryKeyField(), $info);
289286
$this->refresh($info);
290287
} elseif (is_object($info) || is_array($info)) {
291-
292288
foreach ($info as $key => $value) {
293-
294289
if ($key == 'metadata' || $key == 'meta') {
295-
296290
// Try retrieving existing value
297291
if (null === ($metadata = $this->getProperty($key))) {
298292
// If none exists, create new object
@@ -305,21 +299,17 @@ public function populate($info, $setObjects = true)
305299
// Set object property
306300
$this->setProperty($key, $metadata);
307301
} elseif (!empty($this->associatedResources[$key]) && $setObjects === true) {
308-
309302
// Associated resource
310303
try {
311-
312304
$resource = $this->getService()->resource($this->associatedResources[$key], $value);
313305
$resource->setParent($this);
314306

315307
$this->setProperty($key, $resource);
316308
} catch (Exception\ServiceException $e) {
317309
}
318310
} elseif (!empty($this->associatedCollections[$key]) && $setObjects === true) {
319-
320311
// Associated collection
321312
try {
322-
323313
$className = $this->associatedCollections[$key];
324314
$options = $this->makeResourceIteratorOptions($className);
325315
$iterator = ResourceIterator::factory($this, $options, $value);
@@ -328,7 +318,6 @@ public function populate($info, $setObjects = true)
328318
} catch (Exception\ServiceException $e) {
329319
}
330320
} elseif (!empty($this->aliases[$key])) {
331-
332321
// Sometimes we might want to preserve camelCase
333322
// or covert `rax-bandwidth:bandwidth` to `raxBandwidth`
334323
$this->setProperty($this->aliases[$key], $value);

0 commit comments

Comments
 (0)