Skip to content

Commit b43272d

Browse files
SMillerDevStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 823df9e commit b43272d

23 files changed

+381
-439
lines changed

src/PHPDraft/Core/Autoloader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?php
22
/**
3-
* This file contains the Autoloader
3+
* This file contains the Autoloader.
44
*
55
* @package PHPDraft\Core
6+
*
67
* @author Sean Molenaar<[email protected]>
78
*/
89

910
/**
10-
* Autoload classes according to PSR-1
11+
* Autoload classes according to PSR-1.
1112
*/
1213
spl_autoload_register(
1314
function ($classname) {
1415
$classname = ltrim($classname, '\\');
1516
preg_match('/^(.+)?([^\\\\]+)$/U', $classname, $match);
1617
$classname = str_replace('\\', '/', $match[1]) . str_replace(['\\', '_'], '/', $match[2]) . '.php';
17-
if (in_array($classname, ['PHPDraft', 'Mitchelf', 'QL']) !== FALSE){
18+
if (in_array($classname, ['PHPDraft', 'Mitchelf', 'QL']) !== FALSE) {
1819
include_once $classname;
1920
}
2021
}
2122
);
22-
?>

src/PHPDraft/In/ApibFileParser.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
<?php
22
/**
3-
* This file contains the ApibFileParser
3+
* This file contains the ApibFileParser.
44
*
55
* @package PHPDraft\In
6+
*
67
* @author Sean Molenaar<[email protected]>
78
*/
89

910
namespace PHPDraft\In;
1011

1112
/**
12-
* Class ApibFileParser
13+
* Class ApibFileParser.
1314
*/
1415
class ApibFileParser
1516
{
1617
/**
17-
* Complete API Blueprint
18+
* Complete API Blueprint.
1819
*
1920
* @var string
2021
*/
2122
protected $full_apib;
2223

2324
/**
24-
* Location of the API Blueprint to parse
25+
* Location of the API Blueprint to parse.
2526
*
2627
* @var string
2728
*/
2829
protected $location;
2930

3031
/**
31-
* Filename to parse
32+
* Filename to parse.
3233
*
3334
* @var
3435
*/
@@ -56,7 +57,7 @@ public function parse()
5657

5758
/**
5859
* Parse a given API Blueprint file
59-
* This changes all `include(file)` tags to the contents of the file
60+
* This changes all `include(file)` tags to the contents of the file.
6061
*
6162
* @param string $filename File to parse
6263
*
@@ -82,7 +83,7 @@ private function get_apib($filename)
8283
}
8384

8485
/**
85-
* Check if an APIB file exists
86+
* Check if an APIB file exists.
8687
*
8788
* @param string $filename File to check
8889
*
@@ -96,7 +97,7 @@ private function file_check($filename)
9697
}
9798

9899
/**
99-
* Get an external Schema by URL
100+
* Get an external Schema by URL.
100101
*
101102
* @param string $url URL to fetch the schema from
102103
*
@@ -115,13 +116,12 @@ private function get_schema($url)
115116
}
116117

117118
/**
118-
* Return the value of the class
119+
* Return the value of the class.
119120
*
120121
* @return string
121122
*/
122-
function __toString()
123+
public function __toString()
123124
{
124125
return $this->full_apib;
125126
}
126-
127-
}
127+
}

src/PHPDraft/Model/Category.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22
/**
3-
* This file contains the Category.php
3+
* This file contains the Category.php.
44
*
55
* @package PHPDraft\Model
6+
*
67
* @author Sean Molenaar<[email protected]>
78
*/
89

@@ -11,25 +12,25 @@
1112
use PHPDraft\Model\Elements\ObjectStructureElement;
1213

1314
/**
14-
* Class Category
15+
* Class Category.
1516
*/
1617
class Category extends HierarchyElement
1718
{
1819
/**
19-
* API Structure element
20+
* API Structure element.
2021
*
2122
* @var ObjectStructureElement[]
2223
*/
2324
public $structures = [];
2425

2526
/**
26-
* Fill class values based on JSON object
27+
* Fill class values based on JSON object.
2728
*
2829
* @param \stdClass $object JSON object
2930
*
3031
* @return $this self-reference
3132
*/
32-
function parse($object)
33+
public function parse($object)
3334
{
3435
parent::parse($object);
3536
foreach ($object->content as $item) {
@@ -44,8 +45,7 @@ function parse($object)
4445
$struct->deps = $deps;
4546
$struct->parse($item, $deps);
4647

47-
if (is_array($item->content) && isset($item->content[0]->meta->id))
48-
{
48+
if (is_array($item->content) && isset($item->content[0]->meta->id)) {
4949
$this->structures[$item->content[0]->meta->id] = $struct;
5050
} else {
5151
$this->structures[] = $struct;
@@ -60,4 +60,4 @@ function parse($object)
6060

6161
return $this;
6262
}
63-
}
63+
}

src/PHPDraft/Model/Comparable.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
* Created by PhpStorm.
44
* User: smillernl
55
* Date: 28-10-16
6-
* Time: 17:23
6+
* Time: 17:23.
77
*/
88

99
namespace PHPDraft\Model;
1010

11-
1211
interface Comparable
1312
{
1413
/**
15-
* Check if item is the same as other item
14+
* Check if item is the same as other item.
1615
*
1716
* @param self $b Object to compare to
1817
*
1918
* @return bool
2019
*/
2120
public function is_equal_to($b);
22-
}
21+
}

src/PHPDraft/Model/Elements/ArrayStructureElement.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?php
22
/**
3-
* This file contains the ArrayStructureElement.php
3+
* This file contains the ArrayStructureElement.php.
44
*
55
* @package PHPDraft\Model\Elements
6+
*
67
* @author Sean Molenaar<[email protected]>
78
*/
89

910
namespace PHPDraft\Model\Elements;
1011

1112
/**
12-
* Class ArrayStructureElement
13+
* Class ArrayStructureElement.
1314
*/
1415
class ArrayStructureElement extends BasicStructureElement
1516
{
16-
1717
/**
18-
* Parse an array object
18+
* Parse an array object.
1919
*
2020
* @param \stdClass $object APIb Item to parse
2121
* @param array $dependencies List of dependencies build
@@ -28,16 +28,14 @@ public function parse($object, &$dependencies)
2828

2929
$this->parse_common($object, $dependencies);
3030

31-
if(!isset($object->content->value->content))
32-
{
31+
if (!isset($object->content->value->content)) {
3332
$this->value = [];
33+
3434
return $this;
3535
}
3636

37-
foreach ($object->content->value->content as $sub_item)
38-
{
39-
if (!in_array($sub_item->element, self::DEFAULTS))
40-
{
37+
foreach ($object->content->value->content as $sub_item) {
38+
if (!in_array($sub_item->element, self::DEFAULTS)) {
4139
$dependencies[] = $sub_item->element;
4240
}
4341

@@ -50,16 +48,15 @@ public function parse($object, &$dependencies)
5048
}
5149

5250
/**
53-
* Provide HTML representation
51+
* Provide HTML representation.
5452
*
5553
* @return string
5654
*/
57-
function __toString()
55+
public function __toString()
5856
{
5957
$return = '<ul class="list-group mdl-list">';
6058

61-
if (!is_array($this->value))
62-
{
59+
if (!is_array($this->value)) {
6360
return '<span class="example-value pull-right">[ ]</span>';
6461
}
6562

@@ -76,12 +73,12 @@ function __toString()
7673
}
7774

7875
/**
79-
* Get a new instance of a class
76+
* Get a new instance of a class.
8077
*
8178
* @return self
8279
*/
8380
protected function new_instance()
8481
{
85-
return new ArrayStructureElement();
82+
return new self();
8683
}
87-
}
84+
}

0 commit comments

Comments
 (0)