Update to proposed PSR-1 coding standard.

* 4 space (no tab) indent
 * K&R-style braces
This commit is contained in:
Justin Hileman
2012-05-01 22:03:39 -07:00
parent be5cfb3e9e
commit 2448992cc8
57 changed files with 3283 additions and 3009 deletions
+10 -9
View File
@@ -1,13 +1,14 @@
<?php
class ChildContext {
public $parent = array(
'child' => 'child works',
);
class ChildContext
{
public $parent = array(
'child' => 'child works',
);
public $grandparent = array(
'parent' => array(
'child' => 'grandchild works',
),
);
public $grandparent = array(
'parent' => array(
'child' => 'grandchild works',
),
);
}
+6 -4
View File
@@ -1,7 +1,9 @@
<?php
class Comments {
public function title() {
return 'A Comedy of Errors';
}
class Comments
{
public function title()
{
return 'A Comedy of Errors';
}
}
+16 -13
View File
@@ -1,19 +1,22 @@
<?php
class Complex {
public $header = 'Colors';
class Complex
{
public $header = 'Colors';
public $item = array(
array('name' => 'red', 'current' => true, 'url' => '#Red'),
array('name' => 'green', 'current' => false, 'url' => '#Green'),
array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
);
public $item = array(
array('name' => 'red', 'current' => true, 'url' => '#Red'),
array('name' => 'green', 'current' => false, 'url' => '#Green'),
array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
);
public function notEmpty() {
return !($this->isEmpty());
}
public function notEmpty()
{
return !($this->isEmpty());
}
public function isEmpty() {
return count($this->item) === 0;
}
public function isEmpty()
{
return count($this->item) === 0;
}
}
+11 -9
View File
@@ -1,14 +1,16 @@
<?php
class Delimiters {
public $start = "It worked the first time.";
class Delimiters
{
public $start = "It worked the first time.";
public function middle() {
return array(
array('item' => "And it worked the second time."),
array('item' => "As well as the third."),
);
}
public function middle()
{
return array(
array('item' => "And it worked the second time."),
array('item' => "As well as the third."),
);
}
public $final = "Then, surprisingly, it worked the final time.";
public $final = "Then, surprisingly, it worked the final time.";
}
+11 -10
View File
@@ -1,14 +1,15 @@
<?php
class DotNotation {
public $person = array(
'name' => array('first' => 'Chris', 'last' => 'Firescythe'),
'age' => 24,
'hometown' => array(
'city' => 'Cincinnati',
'state' => 'OH',
)
);
class DotNotation
{
public $person = array(
'name' => array('first' => 'Chris', 'last' => 'Firescythe'),
'age' => 24,
'hometown' => array(
'city' => 'Cincinnati',
'state' => 'OH',
)
);
public $normal = 'Normal';
public $normal = 'Normal';
}
+7 -5
View File
@@ -1,9 +1,11 @@
<?php
class DoubleSection {
public function t() {
return true;
}
class DoubleSection
{
public function t()
{
return true;
}
public $two = "second";
public $two = "second";
}
+3 -2
View File
@@ -1,5 +1,6 @@
<?php
class Escaped {
public $title = '"Bear" > "Shark"';
class Escaped
{
public $title = '"Bear" > "Shark"';
}
@@ -1,22 +1,24 @@
<?php
class GrandParentContext {
public $grand_parent_id = 'grand_parent1';
public $parent_contexts = array();
class GrandParentContext
{
public $grand_parent_id = 'grand_parent1';
public $parent_contexts = array();
public function __construct() {
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
array('child_id' => 'parent1-child1'),
array('child_id' => 'parent1-child2')
));
public function __construct()
{
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
array('child_id' => 'parent1-child1'),
array('child_id' => 'parent1-child2')
));
$parent2 = new stdClass();
$parent2->parent_id = 'parent2';
$parent2->child_contexts = array(
array('child_id' => 'parent2-child1'),
array('child_id' => 'parent2-child2')
);
$parent2 = new stdClass();
$parent2->parent_id = 'parent2';
$parent2->child_contexts = array(
array('child_id' => 'parent2-child1'),
array('child_id' => 'parent2-child2')
);
$this->parent_contexts[] = $parent2;
}
$this->parent_contexts[] = $parent2;
}
}
+4 -2
View File
@@ -1,6 +1,7 @@
<?php
class I18n {
class I18n
{
// Variable to be interpolated
public $name = 'Bob';
@@ -14,7 +15,8 @@ class I18n {
'My name is {{ name }}.' => 'Me llamo {{ name }}.',
);
public static function __trans($text) {
public static function __trans($text)
{
return isset(self::$dictionary[$text]) ? self::$dictionary[$text] : $text;
}
}
@@ -1,5 +1,6 @@
<?php
class ImplicitIterator {
public $data = array('Donkey Kong', 'Luigi', 'Mario', 'Peach', 'Yoshi');
class ImplicitIterator
{
public $data = array('Donkey Kong', 'Luigi', 'Mario', 'Peach', 'Yoshi');
}
@@ -1,6 +1,7 @@
<?php
class InvertedDoubleSection {
public $t = false;
public $two = 'second';
class InvertedDoubleSection
{
public $t = false;
public $two = 'second';
}
@@ -1,5 +1,6 @@
<?php
class InvertedSection {
public $repo = array();
class InvertedSection
{
public $repo = array();
}
@@ -1,12 +1,13 @@
<?php
class RecursivePartials {
public $name = 'George';
public $child = array(
'name' => 'Dan',
'child' => array(
'name' => 'Justin',
'child' => false,
)
);
class RecursivePartials
{
public $name = 'George';
public $child = array(
'name' => 'Dan',
'child' => array(
'name' => 'Justin',
'child' => false,
)
);
}
@@ -1,16 +1,18 @@
<?php
class SectionIteratorObjects {
public $start = "It worked the first time.";
class SectionIteratorObjects
{
public $start = "It worked the first time.";
protected $_data = array(
array('item' => 'And it worked the second time.'),
array('item' => 'As well as the third.'),
);
protected $_data = array(
array('item' => 'And it worked the second time.'),
array('item' => 'As well as the third.'),
);
public function middle() {
return new ArrayIterator($this->_data);
}
public function middle()
{
return new ArrayIterator($this->_data);
}
public $final = "Then, surprisingly, it worked the final time.";
public $final = "Then, surprisingly, it worked the final time.";
}
@@ -1,26 +1,31 @@
<?php
class SectionMagicObjects {
public $start = "It worked the first time.";
class SectionMagicObjects
{
public $start = "It worked the first time.";
public function middle() {
return new MagicObject();
}
public function middle()
{
return new MagicObject();
}
public $final = "Then, surprisingly, it worked the final time.";
public $final = "Then, surprisingly, it worked the final time.";
}
class MagicObject {
protected $_data = array(
'foo' => 'And it worked the second time.',
'bar' => 'As well as the third.'
);
class MagicObject
{
protected $_data = array(
'foo' => 'And it worked the second time.',
'bar' => 'As well as the third.'
);
public function __get($key) {
return isset($this->_data[$key]) ? $this->_data[$key] : NULL;
}
public function __get($key)
{
return isset($this->_data[$key]) ? $this->_data[$key] : NULL;
}
public function __isset($key) {
return isset($this->_data[$key]);
}
public function __isset($key)
{
return isset($this->_data[$key]);
}
}
+12 -9
View File
@@ -1,16 +1,19 @@
<?php
class SectionObjects {
public $start = "It worked the first time.";
class SectionObjects
{
public $start = "It worked the first time.";
public function middle() {
return new SectionObject;
}
public function middle()
{
return new SectionObject;
}
public $final = "Then, surprisingly, it worked the final time.";
public $final = "Then, surprisingly, it worked the final time.";
}
class SectionObject {
public $foo = 'And it worked the second time.';
public $bar = 'As well as the third.';
class SectionObject
{
public $foo = 'And it worked the second time.';
public $bar = 'As well as the third.';
}
+11 -9
View File
@@ -1,14 +1,16 @@
<?php
class Sections {
public $start = "It worked the first time.";
class Sections
{
public $start = "It worked the first time.";
public function middle() {
return array(
array('item' => "And it worked the second time."),
array('item' => "As well as the third."),
);
}
public function middle()
{
return array(
array('item' => "And it worked the second time."),
array('item' => "As well as the third."),
);
}
public $final = "Then, surprisingly, it worked the final time.";
public $final = "Then, surprisingly, it worked the final time.";
}
+31 -29
View File
@@ -1,33 +1,35 @@
<?php
class SectionsNested {
public $name = 'Little Mac';
class SectionsNested
{
public $name = 'Little Mac';
public function enemies() {
return array(
array(
'name' => 'Von Kaiser',
'enemies' => array(
array('name' => 'Super Macho Man'),
array('name' => 'Piston Honda'),
array('name' => 'Mr. Sandman'),
)
),
array(
'name' => 'Mike Tyson',
'enemies' => array(
array('name' => 'Soda Popinski'),
array('name' => 'King Hippo'),
array('name' => 'Great Tiger'),
array('name' => 'Glass Joe'),
)
),
array(
'name' => 'Don Flamenco',
'enemies' => array(
array('name' => 'Bald Bull'),
)
),
);
}
public function enemies()
{
return array(
array(
'name' => 'Von Kaiser',
'enemies' => array(
array('name' => 'Super Macho Man'),
array('name' => 'Piston Honda'),
array('name' => 'Mr. Sandman'),
)
),
array(
'name' => 'Mike Tyson',
'enemies' => array(
array('name' => 'Soda Popinski'),
array('name' => 'King Hippo'),
array('name' => 'Great Tiger'),
array('name' => 'Glass Joe'),
)
),
array(
'name' => 'Don Flamenco',
'enemies' => array(
array('name' => 'Bald Bull'),
)
),
);
}
}
+9 -7
View File
@@ -1,12 +1,14 @@
<?php
class Simple {
public $name = "Chris";
public $value = 10000;
class Simple
{
public $name = "Chris";
public $value = 10000;
public function taxed_value() {
return $this->value - ($this->value * 0.4);
}
public function taxed_value()
{
return $this->value - ($this->value * 0.4);
}
public $in_ca = true;
public $in_ca = true;
};
+3 -2
View File
@@ -1,5 +1,6 @@
<?php
class Unescaped {
public $title = "Bear > Shark";
class Unescaped
{
public $title = "Bear > Shark";
}
+3 -2
View File
@@ -1,5 +1,6 @@
<?php
class UTF8 {
public $test = '中文又来啦';
class UTF8
{
public $test = '中文又来啦';
}
+3 -2
View File
@@ -1,5 +1,6 @@
<?php
class UTF8Unescaped {
public $test = '中文又来啦';
class UTF8Unescaped
{
public $test = '中文又来啦';
}
+20 -17
View File
@@ -8,24 +8,27 @@
*
* `{{> tag }}` and `{{> tag}}` and `{{>tag}}` should all be equivalent.
*/
class Whitespace {
public $foo = 'alpha';
class Whitespace
{
public $foo = 'alpha';
public $bar = 'beta';
public $bar = 'beta';
public function baz() {
return 'gamma';
}
public function baz()
{
return 'gamma';
}
public function qux() {
return array(
array('key with space' => 'A'),
array('key with space' => 'B'),
array('key with space' => 'C'),
array('key with space' => 'D'),
array('key with space' => 'E'),
array('key with space' => 'F'),
array('key with space' => 'G'),
);
}
public function qux()
{
return array(
array('key with space' => 'A'),
array('key with space' => 'B'),
array('key with space' => 'C'),
array('key with space' => 'D'),
array('key with space' => 'E'),
array('key with space' => 'F'),
array('key with space' => 'G'),
);
}
}