Skip to content

Commit 613cb0a

Browse files
author
Henry Smith
committed
PSR2 compliance
1 parent fea4506 commit 613cb0a

10 files changed

Lines changed: 37 additions & 22 deletions

File tree

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
default: build
2+
build: phpcs phpunit
3+
4+
phpcs: vendor
5+
./vendor/bin/phpcs --standard="tests/phpcs-ruleset.xml" --error-severity=1 src
6+
./vendor/bin/phpcs --standard="tests/phpcs-ruleset.xml" --error-severity=1 tests
7+
8+
phpunit: vendor
9+
./vendor/bin/phpunit
10+
11+
vendor:
12+
php composer.phar install --dev
13+
14+
.PHONY: build default phpcs phpunit
15+

src/Reddit/Api/Session/Storage/Chain.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ public function retrieveSession($username)
2929
}
3030
}
3131
}
32-

src/Reddit/Api/Session/Storage/Disk.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ private function generateFilename($username)
3939
);
4040
}
4141
}
42-

src/Reddit/Api/Session/Subscriber.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ private function isSuccessfulLogin($body)
6464
return isset($body->json->data->modhash);
6565
}
6666
}
67-

src/Reddit/Reddit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function getLinksByUsername($name)
249249
* @param integer $limit [optional] Maximum number of links
250250
* @return array
251251
*/
252-
public function getLinksBySubreddit($subredditName, $limit=25)
252+
public function getLinksBySubreddit($subredditName, $limit = 25)
253253
{
254254
$verb = 'GET';
255255
$url = "http://www.reddit.com/r/{$subredditName}.json?limit={$limit}";
@@ -554,8 +554,8 @@ public function submit($subredditName, $linkType, $title, $linkUrl)
554554
'.error.RATELIMIT.field-ratelimit',
555555
'you aren\'t allowed to post there.',
556556
'that reddit doesn\'t exist',
557-
'care to try these again?',
558-
'a url is required',
557+
'care to try these again?',
558+
'a url is required',
559559
);
560560

561561
foreach ($response['jquery'] as $element) {

tests/Api/Response/HandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,4 @@ public function processListing()
8484
$output = Api\Response\Handler::fromCommand($this->command);
8585
$this->assertEquals(array($thing), $output);
8686
}
87-
8887
}

tests/Api/Session/Storage/ChainTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,3 @@ public function retrieveSessionStopsWhenFound()
5959
$this->assertEquals($this->session, $session);
6060
}
6161
}
62-

tests/Api/Session/SubscriberTest.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,23 @@ public function onRequestAfterSend()
6464

6565
$this->response
6666
->shouldReceive('getBody')
67-
->andReturn('{
68-
"json": {
69-
"errors": [],
67+
->andReturn(
68+
'{
69+
"json": {
70+
"errors": [],
7071
"data": {
7172
"modhash": "e17aznbup819e98e407734a18ef5a38e4b808dcd3c307ae919",
72-
"cookie": "23636817,2013-11-25T16:21:14,2ab7f75beab690d42276b3d747d587c7a2bc0e27"
73-
}
74-
}
75-
}
76-
')
77-
->once();
73+
"cookie": "23636817,2013-11-25T16:21:14,2ab7f75beab690d42276b3d747d587c7a2bc0e27"
74+
}
75+
}
76+
}'
77+
)
78+
->once();
7879

79-
$this->storage
80-
->shouldReceive('storeSession')
81-
->once();
80+
$this->storage
81+
->shouldReceive('storeSession')
82+
->once();
8283

83-
$this->subscriber->onRequestAfterSend($this->event);
84+
$this->subscriber->onRequestAfterSend($this->event);
8485
}
8586
}

tests/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<?php
22
require_once __DIR__ . '/../vendor/autoload.php';
3-

tests/phpcs-ruleset.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Custom Standard">
3+
<description>PSR2</description>
4+
<rule ref="PSR2"/>
5+
</ruleset>

0 commit comments

Comments
 (0)