Skip to content

Commit cb61f63

Browse files
committedAug 27, 2015
Add TravisCI to php_lib, and codingstandards ignore blocks, and update maintainer in README. Address ISLANDORA-1080.
1 parent 773d12d commit cb61f63

28 files changed

+382
-241
lines changed
 

‎.travis.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: php
2+
php:
3+
- 5.3.3
4+
- 5.4
5+
- 5.5
6+
branches:
7+
only:
8+
- /^7.x/
9+
env:
10+
- FEDORA_VERSION="3.5"
11+
- FEDORA_VERSION="3.6.2"
12+
- FEDORA_VERSION="3.7.0"
13+
before_install:
14+
- cd $HOME
15+
- git clone -b 7.x git://github.com/Islandora/islandora.git
16+
- git clone -b 7.x git://github.com/Islandora/php_lib.git
17+
- export ISLANDORA_DIR=$HOME/islandora
18+
- $HOME/islandora/tests/scripts/travis_setup.sh
19+
- cd $HOME/drupal-*
20+
- ln -s $TRAVIS_BUILD_DIR sites/all/modules/php_lib
21+
- drush en --yes --user=1 php_lib
22+
script:
23+
- ant -buildfile sites/all/modules/php_lib/build.xml lint
24+
- $ISLANDORA_DIR/tests/scripts/line_endings.sh sites/all/modules/php_lib
25+
- drush test-run -v --uri=http://localhost:8081 "PHP Lib"

‎All.inc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
2-
32
/**
43
* @file
5-
*
64
* Include ALL the files in this module.
75
*/
6+
87
module_load_include('inc', 'php_lib', 'Array');
98
module_load_include('inc', 'php_lib', 'Backtrace');
109
module_load_include('inc', 'php_lib', 'DOMHelpers');

‎Array.inc

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76

87
/**
@@ -17,7 +16,9 @@ function array_copy_recursive(array &$array) {
1716
if (is_object($value)) {
1817
$output[$key] = clone $value;
1918
}
20-
else { // Default type copyed by default.
19+
else {
20+
21+
// Default type copyed by default.
2122
$output[$key] = $value;
2223
}
2324
}
@@ -27,8 +28,8 @@ function array_copy_recursive(array &$array) {
2728
/**
2829
*
2930
* @param array $array
30-
* @param type $key
31-
* @param type $value
31+
* @param string or int or object... $key
32+
* @param string or int or object... $value
3233
*/
3334
function array_add(array &$array, $key, $value) {
3435
if (isset($key)) {
@@ -45,6 +46,7 @@ function array_add(array &$array, $key, $value) {
4546
*
4647
* @param array $form
4748
* @param array $indices
49+
*
4850
* @return mixed
4951
* A reference to the value at the final index if found, FALSE otherwise.
5052
*/
@@ -85,7 +87,7 @@ function is_non_empty_array($array) {
8587

8688
/**
8789
*
88-
* @param type $object
90+
* @param string or int or object... $object
8991
* @return type
9092
*/
9193
function object_as_array($object) {
@@ -110,3 +112,4 @@ function array_peek(array $array) {
110112
reset($array);
111113
return array($key, $value);
112114
}
115+
// @codingStandardsIgnoreEnd

‎Backtrace.inc

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
6-
*
75
* Functions for determining call order and such...
86
*/
97

@@ -45,10 +43,10 @@ function get_call_stack_index($index = NULL) {
4543
*
4644
* @param string $property
4745
* A call stack property. Expected to be one of the following.
48-
* function -> The current function name.
49-
* line -> The current line number.
46+
* function -> The current function name.
47+
* line -> The current line number.
5048
* file -> The current file name.
51-
* class -> The current class name.
49+
* class -> The current class name.
5250
* object -> The current object.
5351
* type -> The current call type.
5452
* args -> The arguments to the current function.
@@ -154,3 +152,4 @@ function get_caller_args($index = NULL) {
154152
$index = _ignore_this_in_call_stack($index);
155153
return get_caller_property($index, 'args');
156154
}
155+
// @codingStandardsIgnoreEnd

‎DOMHelpers.inc

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* A collection of functions to help with DOM processing.
76
*/
7+
88
module_load_include('inc', 'php_lib', 'String');
99

1010
/**
@@ -13,6 +13,7 @@ module_load_include('inc', 'php_lib', 'String');
1313
* The returned xpath will return the given node only.
1414
*
1515
* @param DOMNode $node
16+
*
1617
* @return type
1718
*/
1819
function get_dom_node_xpath(DOMNode $node) {
@@ -28,6 +29,7 @@ function get_dom_node_xpath(DOMNode $node) {
2829
* Gets a fragment of the xpath for the given node.
2930
*
3031
* @param DOMNode $node
32+
*
3133
* @return type
3234
*/
3335
function get_dom_node_xpath_fragment(DOMNode $node) {
@@ -50,6 +52,7 @@ function get_dom_node_xpath_fragment(DOMNode $node) {
5052
*
5153
* @param DOMNode $parent
5254
* @param DOMNode $child
55+
*
5356
* @return int
5457
*/
5558
function get_dom_node_xpath_index(DOMNode $parent, DOMNode $child) {
@@ -72,6 +75,7 @@ function get_dom_node_xpath_index(DOMNode $parent, DOMNode $child) {
7275
* Converts a DOMNodeList to an array.
7376
*
7477
* @param DOMNodeList $list
78+
*
7579
* @return array
7680
*/
7781
function dom_node_list_to_array(DOMNodeList $list) {
@@ -104,7 +108,8 @@ function format_dom_document(DOMDocument $document) {
104108
function dom_document_pretty_print_include_files() {
105109
$path = drupal_get_path('module', 'php_lib');
106110
drupal_add_js("$path/js/pretty-print/prettify.js");
107-
drupal_add_css("$path/js/pretty-print/prettify.css"); // @todo move pretty print to a its own module or a lib folder.
111+
drupal_add_css("$path/js/pretty-print/prettify.css");
112+
// @todo move pretty print to a its own module or a lib folder.
108113
}
109114

110115
/**
@@ -147,9 +152,9 @@ function dom_node_children(DOMNode $node, $type = NULL) {
147152
/**
148153
*
149154
* @param DOMNode $node
150-
* @param type $type
151-
* @param type $property
152-
* @param type $value
155+
* @param string or int or object... $type
156+
* @param string or int or object... $property
157+
* @param string or int or object... $value
153158
*/
154159
function dom_node_filter_children(DOMNode $node, $type, $property, $value) {
155160
$output = array();
@@ -166,9 +171,10 @@ function dom_node_filter_children(DOMNode $node, $type, $property, $value) {
166171
* Finds unquie child on params.
167172
*
168173
* @param DOMNode $node
169-
* @param type $type
170-
* @param type $property
171-
* @param type $value
174+
* @param string or int or object... $type
175+
* @param string or int or object... $property
176+
* @param string or int or object... $value
177+
*
172178
* @return type
173179
*/
174180
function dom_node_find_child(DOMNode $node, $type, $property, $value) {
@@ -189,7 +195,8 @@ function dom_node_find_child(DOMNode $node, $type, $property, $value) {
189195
*/
190196
function dom_element_for_each_child(DOMElement $element, $child_type, $user_func /* Variable Arguments */) {
191197
$user_func_args = func_get_args();
192-
array_splice($user_args, 2); // Remove the $element and $user_func.
198+
array_splice($user_args, 2);
199+
// Remove the $element and $user_func.
193200
$children = dom_element_children($element, $child_type);
194201
foreach ($children as $child) {
195202
$args = array_merge(array($child), $user_func_args);
@@ -212,4 +219,4 @@ function dom_element_has_child_elements(DOMNode $node) {
212219
$result = $xpath->query('child::*', $node);
213220
return $result->length > 0;
214221
}
215-
222+
// @codingStandardsIgnoreEnd

‎DrupalFormHelpers.inc

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'Array');
87

@@ -31,7 +30,9 @@ function propagate_form_element_property(array &$element, $property) {
3130
$element[$property] = get_form_element_property($element, $property);
3231
foreach (element_children($element) as $key) {
3332
$child = &$element[$key];
34-
if (!isset($child[$property])) { // Don't squash an existing property value.
33+
if (!isset($child[$property])) {
34+
35+
// Don't squash an existing property value.
3536
$child[$property] = $element[$property];
3637
}
3738
propagate_form_element_property($child, $property);
@@ -43,6 +44,7 @@ function propagate_form_element_property(array &$element, $property) {
4344
*
4445
* @param array $element
4546
* @param string $property
47+
*
4648
* @return mixed
4749
*/
4850
function get_form_element_property(array &$element, $property) {
@@ -68,3 +70,4 @@ function get_element_children(array &$element, $type) {
6870
}
6971
return $children;
7072
}
73+
// @codingStandardsIgnoreEnd

‎Enum.inc

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* A class to model Enumerated types. This is modeled after SplEnum which is only availible via PECL
76
* PECL Restriction: http://de2.php.net/manual/en/spl-types.installation.php
8-
* SplEnum Class: http://de2.php.net/manual/en/class.splenum.php
7+
* SplEnum Class: http://de2.php.net/manual/en/class.splenum.php.
98
*
109
* Instead of forcing users to have PECL extensions installed I'm rewriting the class here.
1110
*/
@@ -31,7 +30,7 @@ abstract class Enum {
3130
* Create an Enumerated instance.
3231
*
3332
* @throws InvalidArgumentException
34-
* @param type $value
33+
* @param string or int or object... $value
3534
*/
3635
public function __construct($value = NULL) {
3736
$this->protected = new ReadOnlyProtectedMembers(array('val' => NULL));
@@ -59,7 +58,7 @@ abstract class Enum {
5958
/**
6059
* Gets the list of the defined constants.
6160
*
62-
* @param boolean $include_default
61+
* @param bool $include_defaultInclude __default in the output?
6362
* Include __default in the output?
6463
*
6564
* @return array
@@ -107,9 +106,9 @@ abstract class Enum {
107106
}
108107

109108
/**
110-
* enum() - a function for generating type safe, iterable, singleton enumerations.
109+
* Enum() - a function for generating type safe, iterable, singleton enumerations.
111110
*
112-
* enum() will create count($args) + 2 classes in the global namespace. It creates
111+
* Enum() will create count($args) + 2 classes in the global namespace. It creates
113112
* an abstract base class with the name $base_class. This class is given static
114113
* methods with the names of each of the enum values.
115114
*
@@ -181,15 +180,19 @@ abstract class Enum {
181180
* }
182181
*
183182
* @author Jonathan Hohle, http://hohle.net
183+
*
184184
* @since 5.June.2008
185+
*
185186
* @license MIT License
186187
*
187188
* @author Nigel Banks, http://nigelbanks.ca
189+
*
188190
* @since 12.10.2011
189191
* Changed the function so that type values get 'namespaced' to prevent polution of the global namespace.
190192
*
191193
* @param $base_class enumeration name
192194
* @param $args array of enum values
195+
*
193196
* @return nothing
194197
*/
195198
function enum($base_class, array $args) {
@@ -199,7 +202,8 @@ function enum($base_class, array $args) {
199202
$type_classes = array();
200203

201204
foreach ($args as $k => $enum) {
202-
$type_class = $base_class . '_' . $enum; // Prevent Collisions
205+
$type_class = $base_class . '_' . $enum;
206+
// Prevent Collisions.
203207
$type_classes[] = $type_class;
204208
$static_method = 'public static function ' . $enum . '() { return ' . $type_class . '::instance(); }';
205209
$enums[$static_method] = '
@@ -252,3 +256,4 @@ function enum($base_class, array $args) {
252256
eval($iterator_declaration);
253257
eval(implode(PHP_EOL, $enums));
254258
}
259+
// @codingStandardsIgnoreEnd

‎File.inc

+183-116
Large diffs are not rendered by default.

‎LazyMembers.inc

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'Members');
87

@@ -30,7 +29,7 @@ class LazyMember {
3029
*/
3130
protected $value;
3231
/**
33-
* Has the value
32+
* Has the value.
3433
*
3534
* @var boolean
3635
*/
@@ -62,7 +61,7 @@ class LazyMember {
6261
}
6362

6463
/**
65-
* Lazy Members.
64+
* Lazy Members.
6665
*/
6766
class LazyMembers extends Members {
6867

@@ -86,6 +85,7 @@ class LazyMembers extends Members {
8685
* Checks to see if a member is lazy.
8786
*
8887
* @param string $name
88+
*
8989
* @return boolean
9090
*/
9191
public function isLazy($name) {
@@ -109,6 +109,7 @@ class LazyMembers extends Members {
109109
* Return NULL if the member doesn't exist or isn't set.
110110
*
111111
* @param string $name
112+
*
112113
* @return mixed
113114
*/
114115
public function __get($name) {
@@ -136,3 +137,4 @@ class LazyMembers extends Members {
136137
}
137138

138139
}
140+
// @codingStandardsIgnoreEnd

‎Members.inc

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'Backtrace');
87
module_load_include('inc', 'php_lib', 'Array');
@@ -25,7 +24,7 @@ class Members {
2524
*/
2625
protected $depth;
2726
/**
28-
* A string of members
27+
* A string of members.
2928
*
3029
* @var array
3130
*/
@@ -92,7 +91,7 @@ class Members {
9291
}
9392

9493
/**
95-
* Adds several members to this class
94+
* Adds several members to this class.
9695
*
9796
* @param array members
9897
* A map of values where the key are the member's names.
@@ -119,6 +118,7 @@ class Members {
119118
* Return NULL if the member doesn't exist or isn't set.
120119
*
121120
* @param string $name
121+
*
122122
* @return mixed
123123
*/
124124
public function __get($name) {
@@ -146,6 +146,7 @@ class Members {
146146
* Checks to see if a member exists and isn't NULL.
147147
*
148148
* @param string $name
149+
*
149150
* @return boolean
150151
*/
151152
public function __isset($name) {
@@ -162,3 +163,4 @@ class Members {
162163
}
163164

164165
}
166+
// @codingStandardsIgnoreEnd

‎Misc.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
function is_non_null($var) {
87
return $var !== NULL;
98
}
9+
// @codingStandardsIgnoreEnd

‎PackedArray.inc

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Provides a 'packed' array for occasions when PHP array consumes to much memory. Not that this class
7-
* is about twice as slow as PHP arrays, but around three times as compressed. It should only be used when dealing with large arrays where
6+
* is about twice as slow as PHP arrays, but around three times as compressed. It should only be used when dealing with large arrays where
87
* processing speed isn't as much of a concern as memory usage.
9-
*
8+
*/
9+
/**
10+
*
1011
*/
1112
class PackedArray implements ArrayAccess, Serializable {
1213

@@ -51,4 +52,5 @@ class PackedArray implements ArrayAccess, Serializable {
5152
$this->array = unserialize($serialized);
5253
}
5354

54-
}
55+
}
56+
// @codingStandardsIgnoreEnd

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PHP Lib
1+
# PHP Lib [![Build Status](https://travis-ci.org/Islandora/php_lib.png?branch=7.x)](https://travis-ci.org/Islandora/php_lib)
22

33
## Introduction
44

@@ -27,7 +27,7 @@ Having problems or solved a problem? Check out the Islandora google groups for a
2727

2828
Current maintainers:
2929

30-
* [Nigel Banks](https://github.com/nigelgbanks)
30+
* [Diego Pino](https://github.com/diegopino)
3131

3232
## Development
3333

‎ReadOnlyMembers.inc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'ReadOnlyPrivateMembers');
87
module_load_include('inc', 'php_lib', 'ReadOnlyProtectedMembers');
@@ -36,7 +35,8 @@ class ReadOnlyMembers {
3635
$properties = array(
3736
'owner_class' => $owner_class,
3837
'depth' => $depth,
39-
); // Account for this class in the depth.
38+
);
39+
// Account for this class in the depth.
4040
$this->private = new ReadOnlyPrivateMembers($private, $properties);
4141
$this->protected = new ReadOnlyProtectedMembers($owner_class, $properties);
4242
}
@@ -107,3 +107,4 @@ class ReadOnlyMembers {
107107
}
108108

109109
}
110+
// @codingStandardsIgnoreEnd

‎ReadOnlyPrivateMembers.inc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'Backtrace');
87

@@ -86,7 +85,7 @@ class ReadOnlyPrivateMembers {
8685
}
8786

8887
/**
89-
* Removes a member
88+
* Removes a member.
9089
*
9190
* @param string $name
9291
*/
@@ -126,3 +125,4 @@ class ReadOnlyPrivateMembers {
126125
}
127126

128127
}
128+
// @codingStandardsIgnoreEnd

‎ReadOnlyProtectedMembers.inc

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76
module_load_include('inc', 'php_lib', 'Backtrace');
87
module_load_include('inc', 'php_lib', 'Array');
@@ -52,8 +51,10 @@ class ReadOnlyProtectedMembers {
5251
* Clone this object, deeply.
5352
*/
5453
public function __clone() {
55-
$this->members = $this->members; // Copy the array
56-
$this->values = $this->values; // References stored in values are shallow copied.
54+
$this->members = $this->members;
55+
// Copy the array.
56+
$this->values = $this->values;
57+
// References stored in values are shallow copied.
5758
}
5859

5960
/**
@@ -92,7 +93,7 @@ class ReadOnlyProtectedMembers {
9293
}
9394

9495
/**
95-
* Removes a member
96+
* Removes a member.
9697
*
9798
* @param string $name
9899
*/
@@ -132,3 +133,4 @@ class ReadOnlyProtectedMembers {
132133
}
133134

134135
}
136+
// @codingStandardsIgnoreEnd

‎ReflectionHelpers.inc

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* A collection of functions that help with reflection like properties.
7-
*
86
*/
97

108
/**
119
* Checks to see if the given variable has a class.
1210
*
1311
* @param mixed $var
12+
*
1413
* @return boolean
1514
*/
1615
function has_class($var) {
@@ -71,4 +70,4 @@ function has_interface($obj, $interface) {
7170
}
7271
return FALSE;
7372
}
74-
73+
// @codingStandardsIgnoreEnd

‎String.inc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
*/
76

87
/**
@@ -12,7 +11,7 @@
1211
* The string to check.
1312
* @param array $matches
1413
* The matches to compare the string with, if none are provided 'true' and 'false' will be used.
15-
* @param boolean $case_sensitive
14+
* @param bool $case_sensitiveDo a case sensitive compare? Defaults to false.
1615
* Do a case sensitive compare? Defaults to false.
1716
*
1817
* @return boolean
@@ -37,7 +36,7 @@ function is_boolean_string($string, array $matches = NULL, $case_sensitive = FAL
3736
* @param array $matches
3837
* The matches to compare the string with, where the key is used to compare and the value is the boolean
3938
* value it repersents. If none are provided 'true' and 'false' will be used.
40-
* @param boolean $case_sensitive
39+
* @param bool $case_sensitiveDo a case sensitive compare? Defaults to false.
4140
* Do a case sensitive compare? Defaults to false.
4241
*
4342
* @return mixed
@@ -126,3 +125,4 @@ function append_to_new_line($string, $appendage) {
126125
function is_non_empty_string($string) {
127126
return is_string($string) && trim($string) != '';
128127
}
128+
// @codingStandardsIgnoreEnd

‎js/pretty-print/prettify.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @codingStandardsIgnoreStart
12
// Copyright (C) 2006 Google Inc.
23
//
34
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +13,6 @@
1213
// See the License for the specific language governing permissions and
1314
// limitations under the License.
1415

15-
1616
/**
1717
* @fileoverview
1818
* some functions for browser-side pretty printing of code contained in html.
@@ -1506,3 +1506,4 @@ window['_pr_isIE6'] = function () {
15061506
'PR_TYPE': PR_TYPE
15071507
};
15081508
})();
1509+
// @codingStandardsIgnoreEnd

‎php_lib.module

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
/**
44
* @file
5+
* Nothing much here.
56
*
6-
* Nothing much here, only include files and functions that need to be accessible without a call to module_load_include.
7+
* Only include files and functions that need to be
8+
* accessible without a call to module_load_include.
79
*/

‎tests/Array.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -26,7 +25,7 @@ class PHPLib_Array_TestCase extends DrupalUnitTestCase {
2625
}
2726

2827
/**
29-
* setUp() performs any pre-requisite tasks that need to happen.
28+
* SetUp() performs any pre-requisite tasks that need to happen.
3029
*/
3130
public function setUp() {
3231
// Enable any modules required for the test.
@@ -43,4 +42,5 @@ class PHPLib_Array_TestCase extends DrupalUnitTestCase {
4342
$this->assertEqual($a, $b, 'array_copy_recursive() produced an array of equal value.');
4443
}
4544

46-
}
45+
}
46+
// @codingStandardsIgnoreEnd

‎tests/Backtrace.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -26,7 +25,7 @@ class PHPLib_Backtrace_TestCase extends DrupalUnitTestCase {
2625
}
2726

2827
/**
29-
* setUp() performs any pre-requisite tasks that need to happen.
28+
* SetUp() performs any pre-requisite tasks that need to happen.
3029
*/
3130
public function setUp() {
3231
// Enable any modules required for the test.
@@ -41,4 +40,5 @@ class PHPLib_Backtrace_TestCase extends DrupalUnitTestCase {
4140

4241
}
4342

44-
}
43+
}
44+
// @codingStandardsIgnoreEnd

‎tests/DOMHelpers.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -26,7 +25,7 @@ class PHPLib_DOMHelpers_TestCase extends DrupalUnitTestCase {
2625
}
2726

2827
/**
29-
* setUp() performs any pre-requisite tasks that need to happen.
28+
* SetUp() performs any pre-requisite tasks that need to happen.
3029
*/
3130
public function setUp() {
3231
// Enable any modules required for the test.
@@ -117,4 +116,5 @@ EOT;
117116
$this->assertEqual(get_dom_node_xpath($b2), "/*[local-name() = 'root'][1]/*[local-name() = 'a'][2]/*[local-name() = 'b'][1]", 'get_dom_node_xpath Namespaces: Path to grandchild element with third type but different parent.');
118117
}
119118

120-
}
119+
}
120+
// @codingStandardsIgnoreEnd

‎tests/DelimitedFile.test

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -50,7 +49,8 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
5049
public function test_isDelimiter() {
5150
$delimiters = array('|', "\r\n");
5251
$this->writeToFile("a|b\nc\r\nd");
53-
$values = array(FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE); // Includes EOF delimiter
52+
$values = array(FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE);
53+
// Includes EOF delimiter.
5454
$file = new DelimitedFile(fopen($this->filename, 'rb'), TextFile::UNIX, $delimiters);
5555
$successful = TRUE;
5656
foreach ($values as $value) {
@@ -62,7 +62,8 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
6262
$file->seek(1, SEEK_CUR);
6363
}
6464
$this->assert($successful, "DelimitedFile::isDelimiter() correctly identified all delimiters.");
65-
unset($file); // Destroy the reference to the file.
65+
unset($file);
66+
// Destroy the reference to the file.
6667
}
6768

6869
/**
@@ -72,7 +73,8 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
7273
$delimiters = array('|', "\r\n");
7374
$content = "a|b\nc\r\nd";
7475
$this->writeToFile($content);
75-
$values = array(0, 2, 2, 3, 4, 7, 7, 7, 7); // Includes EOF delimiter
76+
$values = array(0, 2, 2, 3, 4, 7, 7, 7, 7);
77+
// Includes EOF delimiter.
7678
$file = new DelimitedFile(fopen($this->filename, 'rb'), TextFile::UNIX, $delimiters);
7779
$successful = TRUE;
7880
for ($i = 0; $i < strlen($content); $i++) {
@@ -87,7 +89,8 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
8789
}
8890
}
8991
$this->assert($successful, "DelimitedFile::seekAfterDelimiter() correctly moved pointer to end of all delimiters.");
90-
unset($file); // Destroy the reference to the file.
92+
unset($file);
93+
// Destroy the reference to the file.
9194
}
9295

9396
/**
@@ -111,7 +114,8 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
111114
}
112115
}
113116
$this->assert($successful, "DelimitedFile::getField() correctly identified all fields.");
114-
unset($file); // Destroy the reference to the file.
117+
unset($file);
118+
// Destroy the reference to the file.
115119
}
116120

117121
/**
@@ -136,7 +140,7 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
136140
$values = array(
137141
array('one', 'two'),
138142
array('three', 'four'),
139-
array('five', 'six')
143+
array('five', 'six'),
140144
);
141145
$file = new DelimitedFile(fopen($this->filename, 'rb'), TextFile::UNIX, $delimiters);
142146
$line = 0;
@@ -151,7 +155,9 @@ class PHPLib_DelimitedFile_TestCase extends DrupalUnitTestCase {
151155
$line++;
152156
}
153157
$this->assert($successful, t('DelimitedFile::getFields() correctly read all lines in the file.'));
154-
unset($file); // Destroy the reference to the file.
158+
unset($file);
159+
// Destroy the reference to the file.
155160
}
156161

157162
}
163+
// @codingStandardsIgnoreEnd

‎tests/File.test

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -58,4 +57,5 @@ class PHPLib_File_TestCase extends DrupalUnitTestCase {
5857
$this->assert(!$successful, t('File::seek() won\'t seek past the end of the file if directed not to.'));
5958
}
6059

61-
}
60+
}
61+
// @codingStandardsIgnoreEnd

‎tests/TextFile.test

+33-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Unit Tests.
76
*/
87

@@ -49,9 +48,10 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
4948
*/
5049
public function test_EOL() {
5150
$this->writeToFile("a|b\nc\r\nd");
52-
// Test UNIX
51+
// Test UNIX.
5352
$file = new TextFile(fopen($this->filename, 'rb'), TextFile::UNIX);
54-
$values = array(FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE); // Includes EOF delimiter
53+
$values = array(FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE);
54+
// Includes EOF delimiter.
5555
$successful = TRUE;
5656
foreach ($values as $value) {
5757
if ($file->EOL() !== $value) {
@@ -62,9 +62,10 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
6262
$file->seek(1, SEEK_CUR);
6363
}
6464
$this->assert($successful, "TextFile::EOL() correctly identified all Unix EOL.");
65-
// Test DOS
65+
// Test DOS.
6666
$file = new TextFile(fopen($this->filename, 'rb'), TextFile::DOS);
67-
$values = array(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE); // Includes EOF delimiter
67+
$values = array(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE);
68+
// Includes EOF delimiter.
6869
$successful = TRUE;
6970
foreach ($values as $value) {
7071
if ($file->EOL() !== $value) {
@@ -75,9 +76,10 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
7576
$file->seek(1, SEEK_CUR);
7677
}
7778
$this->assert($successful, "TextFile::EOL() correctly identified all DOS EOL.");
78-
// Test MAC
79+
// Test MAC.
7980
$file = new TextFile(fopen($this->filename, 'rb'), TextFile::MAC);
80-
$values = array(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE); // Includes EOF delimiter
81+
$values = array(FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE);
82+
// Includes EOF delimiter.
8183
$successful = TRUE;
8284
foreach ($values as $value) {
8385
if ($file->EOL() !== $value) {
@@ -88,13 +90,15 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
8890
$file->seek(1, SEEK_CUR);
8991
}
9092
$this->assert($successful, "TextFile::EOL() correctly identified all MAC EOL.");
91-
unset($file); // Destroy the reference to the file.
93+
unset($file);
94+
// Destroy the reference to the file.
9295
}
9396

9497
public function test_seekBeforeEOL() {
9598
$content = "a|b\nc\r\nd";
9699
$this->writeToFile($content);
97-
$values = array(0, 1, 2, 2, 4, 5, 5, 7, 7); // Includes EOF delimiter
100+
$values = array(0, 1, 2, 2, 4, 5, 5, 7, 7);
101+
// Includes EOF delimiter.
98102
$file = new TextFile(fopen($this->filename, 'rb'));
99103
$successful = TRUE;
100104
for ($i = 0; $i < strlen($content); $i++) {
@@ -109,13 +113,15 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
109113
}
110114
}
111115
$this->assert($successful, "TextFile::seekBeforeEOL() correctly moved pointer to before all EOL.");
112-
unset($file); // Destroy the reference to the file.
116+
unset($file);
117+
// Destroy the reference to the file.
113118
}
114119

115120
public function test_seekAfterEOL() {
116121
$content = "a|b\nc\r\nd";
117122
$this->writeToFile($content);
118-
$values = array(0, 1, 2, 4, 4, 5, 7, 7, 7); // Includes EOF delimiter
123+
$values = array(0, 1, 2, 4, 4, 5, 7, 7, 7);
124+
// Includes EOF delimiter.
119125
$file = new TextFile(fopen($this->filename, 'rb'));
120126
$successful = TRUE;
121127
for ($i = 0; $i < strlen($content); $i++) {
@@ -130,13 +136,15 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
130136
}
131137
}
132138
$this->assert($successful, "TextFile::seekAfterEOL() Correctly moved pointer to after all EOL.");
133-
unset($file); // Destroy the reference to the file.
139+
unset($file);
140+
// Destroy the reference to the file.
134141
}
135142

136143
public function test_seekLineStart() {
137144
$content = "a|b\nc\r\nd";
138145
$this->writeToFile($content);
139-
$values = array(0, 0, 0, 0, 4, 4, 4, 7, 7); // Includes EOF delimiter
146+
$values = array(0, 0, 0, 0, 4, 4, 4, 7, 7);
147+
// Includes EOF delimiter.
140148
$file = new TextFile(fopen($this->filename, 'rb'));
141149
$successful = TRUE;
142150
for ($i = 0; $i < strlen($content); $i++) {
@@ -151,13 +159,15 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
151159
}
152160
}
153161
$this->assert($successful, "TextFile::seekLineStart() correctly moved pointer to the start of each line.");
154-
unset($file); // Destroy the reference to the file.
162+
unset($file);
163+
// Destroy the reference to the file.
155164
}
156165

157166
public function test_seekLineEnd() {
158167
$content = "a|b\nc\r\nd";
159168
$this->writeToFile($content);
160-
$values = array(3, 3, 3, 3, 6, 6, 6, 8, 8); // Includes EOF delimiter
169+
$values = array(3, 3, 3, 3, 6, 6, 6, 8, 8);
170+
// Includes EOF delimiter.
161171
$file = new TextFile(fopen($this->filename, 'rb'));
162172
$successful = TRUE;
163173
for ($i = 0; $i < strlen($content); $i++) {
@@ -172,13 +182,15 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
172182
}
173183
}
174184
$this->assert($successful, "TextFile::seekLineEnd() correctly moved pointer to after all EOL.");
175-
unset($file); // Destroy the reference to the file.
185+
unset($file);
186+
// Destroy the reference to the file.
176187
}
177188

178189
public function test_seekPrevLineEnd() {
179190
$content = "a|b\nc\r\nd";
180191
$this->writeToFile($content);
181-
$values = array(3, 3, 3, 3, 6, 6, 6, 8, 8); // Includes EOF delimiter
192+
$values = array(3, 3, 3, 3, 6, 6, 6, 8, 8);
193+
// Includes EOF delimiter.
182194
$file = new TextFile(fopen($this->filename, 'rb'));
183195
$successful = TRUE;
184196
for ($i = 0; $i < strlen($content); $i++) {
@@ -193,7 +205,9 @@ class PHPLib_TextFile_TestCase extends DrupalUnitTestCase {
193205
}
194206
}
195207
$this->assert($successful, "TextFile::seekLineEnd() correctly moved pointer to after all EOL.");
196-
unset($file); // Destroy the reference to the file.
208+
unset($file);
209+
// Destroy the reference to the file.
197210
}
198211

199212
}
213+
// @codingStandardsIgnoreStart

‎xml/EACCPFDocument.inc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Abstracts EAC-CPF xml document into a PHP class where the maintence history is maintained automatically by the class.
7-
*
86
*/
97
module_load_include('inc', 'islandora_metadata', 'XMLDocument');
108

119
/**
12-
* EACCPFType:
10+
* EACCPFType:.
1311
*
1412
* SINGLE IDENTITY: one person (or corporate body or family) with a single identity represented in one
1513
* EAC-CPF instance. (Most common)
@@ -40,7 +38,8 @@ enum('EACCPFType', array(
4038
enum('EACCPFMaintenceStatusType', array(
4139
'revised' => 'revised',
4240
'deleted' => 'deleted',
43-
'new' => 'created', // Since the new keyword is prohibited use created to reference new.
41+
'new' => 'created',
42+
// Since the new keyword is prohibited use created to reference new.
4443
'deletedSplit' => 'deletedSplit',
4544
'deletedReplaced' => 'deletedReplaced',
4645
'cancelled' => 'cancelled',
@@ -201,3 +200,4 @@ class EACCPFDocument extends _XMLDocument {
201200
}
202201

203202
}
203+
// @codingStandardsIgnoreEnd

‎xml/XMLDocument.inc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
2-
2+
// @codingStandardsIgnoreStart
33
/**
44
* @file
5-
*
65
* Tempory dump for classes and functions.
76
*/
87
module_load_include('inc', 'islandora_metadata', 'Enum');
@@ -53,8 +52,10 @@ class XMLDocumentValidator {
5352
switch ($this->type) {
5453
case XMLSchemaFormat::DTD():
5554
return $document->validate();
55+
5656
case XMLSchemaFormat::XSD():
5757
return $document->schemaValidate($this->filename);
58+
5859
case XMLSchemaFormat::RNG():
5960
return $document->relaxNGValidate($this->filename);
6061
}
@@ -67,7 +68,7 @@ class XMLDocumentValidator {
6768
*/
6869
class XMLDocumentNamepaces {
6970
/**
70-
* Constants
71+
* Constants.
7172
*/
7273
const xmlns = 'http://www.w3.org/2000/xmlns/';
7374

@@ -249,3 +250,4 @@ class _XMLDocument extends DOMDocument {
249250
}
250251

251252
}
253+
// @codingStandardsIgnoreEnd

0 commit comments

Comments
 (0)
Please sign in to comment.