diff --git a/src/Curl/CaseInsensitiveArray.php b/src/Curl/CaseInsensitiveArray.php
new file mode 100644
index 0000000..6aa6147
--- /dev/null
+++ b/src/Curl/CaseInsensitiveArray.php
@@ -0,0 +1,73 @@
+container[] = $value;
+ } else {
+ $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
+ if (!($index === false)) {
+ $keys = array_keys($this->container);
+ unset($this->container[$keys[$index]]);
+ }
+ $this->container[$offset] = $value;
+ }
+ }
+
+ public function offsetExists($offset)
+ {
+ return array_key_exists(strtolower($offset), array_change_key_case($this->container, CASE_LOWER));
+ }
+
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+
+ public function offsetGet($offset)
+ {
+ $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
+ if ($index === false) {
+ return null;
+ }
+
+ $values = array_values($this->container);
+ return $values[$index];
+ }
+
+ public function count()
+ {
+ return count($this->container);
+ }
+
+ public function current()
+ {
+ return current($this->container);
+ }
+
+ public function next()
+ {
+ return next($this->container);
+ }
+
+ public function key()
+ {
+ return key($this->container);
+ }
+
+ public function valid()
+ {
+ return !($this->current() === false);
+ }
+
+ public function rewind()
+ {
+ reset($this->container);
+ }
+}
diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php
index 228b52f..3d184d5 100644
--- a/src/Curl/Curl.php
+++ b/src/Curl/Curl.php
@@ -4,7 +4,7 @@ namespace Curl;
class Curl
{
- const VERSION = '4.8.0';
+ const VERSION = '4.8.1';
const DEFAULT_TIMEOUT = 30;
public $curl;
@@ -997,73 +997,3 @@ class Curl
return (bool)count(array_filter($array, 'is_array'));
}
}
-
-class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
-{
- private $container = array();
-
- public function offsetSet($offset, $value)
- {
- if ($offset === null) {
- $this->container[] = $value;
- } else {
- $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
- if (!($index === false)) {
- $keys = array_keys($this->container);
- unset($this->container[$keys[$index]]);
- }
- $this->container[$offset] = $value;
- }
- }
-
- public function offsetExists($offset)
- {
- return array_key_exists(strtolower($offset), array_change_key_case($this->container, CASE_LOWER));
- }
-
- public function offsetUnset($offset)
- {
- unset($this->container[$offset]);
- }
-
- public function offsetGet($offset)
- {
- $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
- if ($index === false) {
- return null;
- }
-
- $values = array_values($this->container);
- return $values[$index];
- }
-
- public function count()
- {
- return count($this->container);
- }
-
- public function current()
- {
- return current($this->container);
- }
-
- public function next()
- {
- return next($this->container);
- }
-
- public function key()
- {
- return key($this->container);
- }
-
- public function valid()
- {
- return !($this->current() === false);
- }
-
- public function rewind()
- {
- reset($this->container);
- }
-}
diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php
index 302aafd..01d7337 100644
--- a/tests/PHPCurlClass/PHPCurlClassTest.php
+++ b/tests/PHPCurlClass/PHPCurlClassTest.php
@@ -1,6 +1,4 @@
-
- .
-
-
-
-
+
+
+
+ ./PHPCurlClass/
+
+
diff --git a/tests/script.sh b/tests/script.sh
index 1756d6d..39cf868 100755
--- a/tests/script.sh
+++ b/tests/script.sh
@@ -1,21 +1,21 @@
# Check syntax in php files.
-find . -type "f" -iname "*.php" -exec php -l {} \;
+find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec php -l {} \;
# Run tests.
-cd tests && phpunit --configuration phpunit.xml
+phpunit --configuration tests/phpunit.xml
if [[ "${?}" -ne 0 ]]; then
exit 1
fi
# Enforce line ending consistency in php files.
-crlf_file=$(find . -type "f" -iname "*.php" -exec grep --files-with-matches $'\r' {} \;)
+crlf_file=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --files-with-matches $'\r' {} \;)
if [[ ! -z "${crlf_file}" ]]; then
echo "${crlf_file}" | perl -pe 's/(.*)/CRLF line terminators found in \1/'
exit 1
fi
# Enforce indentation character consistency in php files.
-tab_char=$(find . -type "f" -iname "*.php" -exec grep --line-number -H --perl-regexp "\t" {} \;)
+tab_char=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec grep --line-number -H --perl-regexp "\t" {} \;)
if [[ ! -z "${tab_char}" ]]; then
echo -e "${tab_char}" | perl -pe 's/^(.*)$/Tab character found in \1/'
exit 1
@@ -50,7 +50,7 @@ EOF
# Skip hhvm "Notice: File could not be loaded: ..."
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]]; then
export -f "find_invalid_indentation"
- invalid_indentation=$(find . -type "f" -iname "*.php" -exec bash -c 'find_invalid_indentation "{}"' \;)
+ invalid_indentation=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec bash -c 'find_invalid_indentation "{}"' \;)
if [[ ! -z "${invalid_indentation}" ]]; then
echo "${invalid_indentation}"
exit 1
@@ -58,14 +58,14 @@ if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]]; then
fi
# Prohibit trailing whitespace in php files.
-trailing_whitespace=$(find . -type "f" -iname "*.php" -exec egrep --line-number -H " +$" {} \;)
+trailing_whitespace=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --line-number -H " +$" {} \;)
if [[ ! -z "${trailing_whitespace}" ]]; then
echo -e "${trailing_whitespace}" | perl -pe 's/^(.*)$/Trailing whitespace found in \1/'
exit 1
fi
# Prohibit long lines in php files.
-long_lines=$(find . -type "f" -iname "*.php" -exec awk '{print FILENAME":"NR" "length}' {} \; | awk '$2 > 120')
+long_lines=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec awk '{print FILENAME":"NR" "length}' {} \; | awk '$2 > 120')
if [[ ! -z "${long_lines}" ]]; then
echo -e "${long_lines}" | perl -pe 's/^(.*)$/Long lines found in \1/'
exit 1