Browse Source

inArray Utility method to avoid buggy in_array() and FolderLib/FileLib core enhancements

euromark 13 years ago
parent
commit
c7eba60015

+ 261 - 0
Lib/Utility/FileLib.php

@@ -0,0 +1,261 @@
+<?php
+
+App::uses('File', 'Utility');
+
+/**
+ * 2010-05-16 ms
+ */
+class FileLib extends File {
+
+	/**
+	 * Convenience class for reading, writing and appending to files.
+	 * 2009-06-15 ms
+	 */
+	protected $allowedDelimiters = array(
+		',',
+		';',
+		'|',
+		' ',
+		'#');
+
+	protected $allowedEnclosures = array('"', '\'');
+
+	protected $allowedTags = array(
+		'<h1>',
+		'<h2>',
+		'<h3>',
+		'<p>',
+		'<b>',
+		'<a>',
+		'<img>');
+
+	protected $defaultFormat = '%s'; // %s\t%s\t%s => 	some	nice	text
+
+	public function __destruct() {
+		$this->close();
+	}
+
+	/**
+	 * A better csv reader which handles encoding as well as removes completely empty lines
+	 *
+	 * 2009-06-15 ms
+	 */
+	public function readCsv($length = 0, $delimiter = null, $enclosure = null, $mode = 'rb', $force = false, $removeEmpty = false) {
+		$res = array();
+		if ($this->open($mode, $force) === false) {
+			return false;
+		}
+
+		if ($this->lock !== null && flock($this->handle, LOCK_SH) === false) {
+			return false;
+		}
+
+		# php cannot handle delimiters with more than a single char
+		if (mb_strlen($delimiter) > 1) {
+			$count = 0;
+			while (!feof($this->handle)) {
+				if ($count > 100) {
+					throw new RuntimeException('max recursion depth');
+				}
+				$count++;
+				$tmp = fgets($this->handle, 8000);
+				$tmp = explode($delimiter, $tmp);
+				if (true || WINDOWS) {
+					$tmp = $this->_encode($tmp);
+				}
+				$isEmpty = true;
+				foreach ($tmp as $key => $val) {
+					if (!empty($val)) {
+						$isEmpty = false;
+						break;
+					}
+				}
+				if ($isEmpty) {
+					continue;
+				}
+				$res[] = $tmp;
+			}
+
+		} else {
+			while (true) {
+				$data = fgetcsv($this->handle, $length, (!empty($delimiter) ? $delimiter : ','), (!empty($enclosure) ? $enclosure : '"'));
+				if ($data === false) {
+					break;
+				}
+				if (true || WINDOWS) {
+					$data = $this->_encode($data);
+				}
+				$isEmpty = true;
+				foreach ($data as $key => $val) {
+					if (!empty($val)) {
+						$isEmpty = false;
+						break;
+					}
+				}
+				if ($isEmpty && $removeEmpty) {
+					continue;
+				}
+				$res[] = $data;
+			}
+		}
+
+		if ($this->lock !== null) {
+			flock($this->handle, LOCK_UN);
+		}
+		$this->close();
+		return $res;
+	}
+
+	/**
+	 * Write an array to a csv file
+	 *
+	 * @param array $data
+	 * @return bool $success
+	 * 2012-07-06 ms
+	 */
+	public function writeCsv($data, $delimiter = null, $enclosure = null) {
+		if ($this->open('w', true) !== true) {
+			return false;
+		}
+		if ($this->lock !== null) {
+			if (flock($this->handle, LOCK_EX) === false) {
+				return false;
+			}
+		}
+		$success = true;
+		foreach ($data as $row) {
+			if (fputcsv($this->handle, array_values($row), (isset($delimiter) ? $delimiter : ','), (isset($enclosure) ? $enclosure : '"')) === false) {
+				$success = false;
+			}
+		}
+		if ($this->lock !== null) {
+			flock($this->handle, LOCK_UN);
+		}
+		$this->close();
+		return $success;
+	}
+
+	/**
+	 * 2009-06-15 ms
+	 */
+	public function readWithPattern($format = null, $mode = 'rb', $force = false) {
+		$res = array();
+		if ($this->open($mode, $force) === false) {
+			return false;
+		}
+
+		if ($this->lock !== null && flock($this->handle, LOCK_SH) === false) {
+			return false;
+		}
+
+		if (empty($format)) {
+			$format = $this->defaultFormat;
+		}
+
+		while (true) {
+			$data = fscanf($this->handle, $format);
+			if ($data === false) {
+				break;
+			}
+			$res[] = $data;
+		}
+
+		if ($this->lock !== null) {
+			flock($this->handle, LOCK_UN);
+		}
+
+		return $res;
+	}
+
+	/**
+	 * Return the contents of this File as a string - but without tags
+	 *
+	 * @param string/array $tags: <tag><tag2><tag3> or array('<tag>',...) otherwise default tags are used
+	 * @param string $mode
+	 * @param boolean $force If true then the file will be re-opened even if its already opened, otherwise it won't
+	 * @return mixed string on success, false on failure
+	 * @access public
+	 * 2009-06-15 ms
+	 */
+	public function readWithTags($tags = null, $mode = 'rb', $force = false) {
+		if ($this->open($mode, $force) === false) {
+			return false;
+		}
+		if ($this->lock !== null && flock($this->handle, LOCK_SH) === false) {
+			return false;
+		}
+
+		if (empty($tags)) {
+			$tags = implode($this->allowedTags);
+		} else {
+			if (is_array($tags)) {
+				$tags = implode($tags);
+			}
+		}
+
+		$data = '';
+		while (!feof($this->handle)) {
+			$data .= fgetss($this->handle, 4096, $tags);
+		}
+		$data = trim($data);
+
+		if ($this->lock !== null) {
+			flock($this->handle, LOCK_UN);
+		}
+
+		return $data;
+	}
+
+	/**
+	 * transfer array to cake structure
+	 * @param data (usually with the first row as keys!)
+	 * @param options
+	 * - keys (defaults to first array content in data otherwise) (order is important!)
+	 * - preserve_keys (do not slug and lowercase)
+	 * @return array $result or FALSE on failure
+	 * 2010-10-15 ms
+	 */
+	public function transfer($data, $options = array()) {
+		$res = array();
+
+		if (empty($options['keys'])) {
+			$keys = array_shift($data);
+		} else {
+			$keys = $options['keys'];
+		}
+
+		foreach ($keys as $num => $key) {
+			if (empty($options['preserve_keys'])) {
+				$key = strtolower(Inflector::slug($key));
+			}
+			foreach ($data as $n => $val) {
+				$res[$n][$key] = $val[$num];
+			}
+		}
+		return $res;
+	}
+
+	/**
+	 * Assert proper encoding
+	 *
+	 * @param array
+	 * @return array
+	 */
+	protected function _encode(array $array) {
+		$convertedArray = array();
+		foreach ($array as $key => $value) {
+			if (!mb_check_encoding($key, 'UTF-8')) {
+				$key = utf8_encode($key);
+			}
+			if (is_array($value)) {
+				$value = $this->_encode($value);
+			}
+			if (!mb_check_encoding($value, 'UTF-8')) {
+				$value = utf8_encode($value);
+			}
+			$convertedArray[$key] = trim($value);
+		}
+		return $convertedArray;
+	}
+
+}

+ 58 - 0
Lib/Utility/FolderLib.php

@@ -0,0 +1,58 @@
+<?php
+App::uses('Folder', 'Utility');
+
+/**
+ * Folder lib with a few custom improvements
+
+ * 2010-05-16 ms
+ */
+class FolderLib extends Folder {
+
+	/**
+	 * Empty the folder.
+	 * Instead of deleting the folder itself as delete() does,
+	 * this method only removes its content recursivly.
+	 *
+	 * @return boolean $success or null on invalid folder
+	 * 2010-12-07 ms
+	 */
+	public function clear($path = null) {
+		if (!$path) {
+			$path = $this->pwd();
+		}
+		if (!$path) {
+			return null;
+		}
+		$path = Folder::slashTerm($path);
+		if (is_dir($path)) {
+			$normalFiles = glob($path . '*');
+			$hiddenFiles = glob($path . '\.?*');
+
+			$normalFiles = $normalFiles ? $normalFiles : array();
+			$hiddenFiles = $hiddenFiles ? $hiddenFiles : array();
+
+			$files = array_merge($normalFiles, $hiddenFiles);
+			if (is_array($files)) {
+				foreach ($files as $file) {
+					if (preg_match('/(\.|\.\.)$/', $file)) {
+						continue;
+					}
+					chmod($file, 0770);
+					if (is_file($file)) {
+						if (@unlink($file)) {
+							$this->_messages[] = __('%s removed', $file);
+						} else {
+							$this->_errors[] = __('%s NOT removed', $file);
+						}
+					} elseif (is_dir($file) && $this->delete($file) === false) {
+						return false;
+					}
+				}
+			}
+		} else {
+			unlink($path);
+		}
+		return true;
+	}
+
+}

+ 14 - 0
Lib/Utility/Utility.php

@@ -12,6 +12,20 @@ App::uses('Router', 'Routing');
 class Utility {
 
 	/**
+	 * in_array itself has some PHP flaws regarding cross-type comparison
+	 * - in_array('50x', array(40, 50, 60)) would be true!
+	 * - in_array(50, array('40x', '50x', '60x')) would be true!
+	 *
+	 * @param mixed $needle
+	 * @param array $haystack
+	 * @return bool Success
+	 */
+	public static function inArray($needle, $haystack) {
+		$strict = !is_numeric($needle);
+		return in_array((string)$needle, $haystack, $strict);
+	}
+
+	/**
 	 * get the current ip address
 	 * @param bool $safe
 	 * @return string $ip

+ 261 - 0
Test/Case/Lib/Utility/FileLibTest.php

@@ -0,0 +1,261 @@
+<?php
+App::uses('FileLib', 'Tools.Utility');
+
+/**
+ *
+ */
+class FileLibTest extends CakeTestCase {
+
+	/**
+	 * test method
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function testReadCsv1() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+
+		$pre = '"First", "Last Name", "Email"' . NL . '"Example", "Firsty", "test@test.com"'; //.NL.'"Next", "Secondy", "again@test.com"'
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readCsv(1024, ',', '"');
+		$expected = array(array(
+				'First',
+				'Last Name',
+				'Email'), array(
+				'Example',
+				'Firsty',
+				'test@test.com'));
+
+		$status = $this->assertEquals($expected, $is);
+		$this->_printArrays($status, $is, $expected, $pre);
+	}
+
+	public function testReadCsv2() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+
+		$pre = '\'First\', \'Last Name\', \'Email\'' . NL . '\'Example\', \'Firsty\', \'test@test.com\''; //.NL.'\'Next\', \'Secondy\', \'again@test.com\''
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readCsv(1024, ',', '\'');
+		$expected = array(array(
+				'First',
+				'Last Name',
+				'Email'), array(
+				'Example',
+				'Firsty',
+				'test@test.com'));
+
+		$status = $this->assertEquals($expected, $is);
+		$this->_printArrays($status, $is, $expected, $pre);
+	}
+
+	/**
+	 * test method
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function testReadWithTags1() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+
+		$pre = '<h1>Header</h1><p><b>Bold Text</b></p><hr />Between to lines<hr></p><h4>Some Subheader</h4>Some more text at the end';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readWithTags();
+		$expected = '<h1>Header</h1><p><b>Bold Text</b></p>Between to lines</p>Some SubheaderSome more text at the end';
+
+		$status = $this->assertEquals($expected, $is);
+		$this->_printArrays($status, $is, $expected, $pre);
+	}
+
+	/**
+	 * test csv file generation from array
+	 * 2012-07-06 ms
+	 */
+	public function testWriteCsv() {
+		$handler = new FileLib(TMP . 'test.csv', true);
+		$array = array(
+			array(
+				'header1',
+				'header2',
+				'header3'),
+			array(
+				'v1a',
+				'v1b',
+				'v1c'),
+			array(
+				'v2a',
+				'v2b',
+				'v2c'),
+			);
+
+		$res = $handler->writeCsv($array);
+		$this->assertTrue($res);
+
+		$handler = new FileLib(TMP . 'test.csv', true);
+		$res = $handler->readCsv(1024);
+		$this->assertEquals($array, $res);
+	}
+
+
+	/**
+	 * test method
+	 *
+	 * @access public
+	 * @return void
+	 */
+	public function testReadWithPattern1() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+
+		$pre = 'First' . TB . 'LastName' . TB . 'Email' . NL . 'Example' . TB . 'Firsty' . TB . 'test@test.com';
+		//$pre = 'First, Last Name, Email'.PHP_EOL.'Example, Firsty, test@test.com';
+		//$pre = 'First-LastName-Email'.NL.'Example-Firsty-test@test.com';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readWithPattern('%s' . TB . '%s' . TB . '%s');
+		$expected = array(array(
+				'First',
+				'LastName',
+				'Email'), array(
+				'Example',
+				'Firsty',
+				'test@test.com'));
+
+		$status = $this->assertEquals($expected, $is);
+		$this->_printArrays($status, $is, $expected, $pre);
+	}
+
+	public function testReadWithPattern2() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+
+		$pre = '2-33-44' . NL . '5-66-77';
+		//$pre = 'First, Last Name, Email'.PHP_EOL.'Example, Firsty, test@test.com';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readWithPattern('%d-%d-%d');
+		$expected = array(array(
+				'2',
+				'33',
+				'44'), array(
+				'5',
+				'66',
+				'77'));
+
+		$status = $this->assertEquals($expected, $is);
+		$this->_printArrays($status, $is, $expected, $pre);
+	}
+
+
+	public function testTransfer() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+		$pre = '"First", "Last Name", "Email"' . NL . '"Example", "Firsty", "test@test.com"' . NL . '"Next", "Secondy", "again@test.com"';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readCsv(1024, ',', '"');
+
+		$is = $handler2->transfer($is);
+		pr($is);
+		$expected = array(array(
+				'first' => 'Example',
+				'last_name' => 'Firsty',
+				'email' => 'test@test.com'), array(
+				'first' => 'Next',
+				'last_name' => 'Secondy',
+				'email' => 'again@test.com'));
+		$this->assertEquals($is, $expected);
+	}
+
+	public function testTransferWithManualKeys() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+		$pre = '"First", "Last Name", "Email"' . NL . '"Example", "Firsty", "test@test.com"' . NL . '"Next", "Secondy", "again@test.com"';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readCsv(1024, ',', '"');
+		array_shift($is);
+		$is = $handler2->transfer($is, array('keys' => array(
+				'X',
+				'Y',
+				'Z'), 'preserve_keys' => true));
+		pr($is);
+		$expected = array(array(
+				'X' => 'Example',
+				'Y' => 'Firsty',
+				'Z' => 'test@test.com'), array(
+				'X' => 'Next',
+				'Y' => 'Secondy',
+				'Z' => 'again@test.com'));
+		$this->assertEquals($is, $expected);
+
+	}
+
+	public function testReadCsvWithEmpty() {
+		$handler = new FileLib(TMP . 'test.txt', true);
+		$pre = '"First", "Last Name", "Email"' . NL . ',,' . NL . '"Next", "Secondy", "again@test.com"';
+
+		$handler->write($pre);
+		$handler->close();
+
+		$handler2 = new FileLib(TMP . 'test.txt', true);
+
+		$is = $handler2->readCsv(1024, ',', '"', 'rb', false, true);
+		array_shift($is);
+		$is = $handler2->transfer($is, array('keys' => array(
+				'X',
+				'Y',
+				'Z'), 'preserve_keys' => true));
+		pr($is);
+		$expected = array(array(
+				'X' => 'Next',
+				'Y' => 'Secondy',
+				'Z' => 'again@test.com'));
+		$this->assertEquals($is, $expected);
+	}
+
+	/** Helper Functions **/
+
+	public function _printArrays($status, $is, $expected, $pre = null) {
+		if (!isset($_GET['show_passes']) || !$_GET['show_passes']) {
+			return false;
+		}
+
+		if ($pre !== null) {
+			echo 'pre:';
+			pr($pre);
+		}
+		echo 'is:';
+		pr($is);
+		if (!$status) {
+			echo 'expected:';
+			pr($expected);
+		}
+	}
+}

+ 20 - 0
Test/Case/Lib/Utility/FolderLibTest.php

@@ -0,0 +1,20 @@
+<?php
+
+App::uses('FolderLib', 'Tools.Utility');
+App::uses('MyCakeTestCase', 'Tools.TestSuite');
+
+class FolderLibTest extends MyCakeTestCase {
+
+	public $FolderLib;
+
+	public function setUp() {
+		$this->FolderLib = new FolderLib();
+	}
+
+	public function testObject() {
+		$this->assertTrue(is_object($this->FolderLib));
+		$this->assertInstanceOf('FolderLib', $this->FolderLib);
+	}
+
+	//TODO
+}

+ 224 - 0
Test/Case/Lib/Utility/UtilityTest.php

@@ -0,0 +1,224 @@
+<?php
+App::uses('Utility', 'Tools.Utility');
+App::uses('MyCakeTestCase', 'Tools.TestSuite');
+
+/**
+ * 2012-02-21 ms
+ */
+class UtilityTest extends MyCakeTestCase {
+
+	public function testInArray() {
+		$res = Utility::inArray(2, array(1, 2, 3));
+		$this->assertTrue($res);
+
+		$res = Utility::inArray(4, array(1, 2, 7));
+		$this->assertFalse($res);
+
+		$res = Utility::inArray('2', array(1, 2, 3));
+		$this->assertTrue($res);
+
+		$res = Utility::inArray(2, array('1x', '2x', '3x'));
+		$this->assertFalse($res);
+
+		$res = Utility::inArray('3x', array('1x', '2x', '3x'));
+		$this->assertTrue($res);
+
+		$res = Utility::inArray(3, array('1', '2', '3'));
+		$this->assertTrue($res);
+
+		$res = Utility::inArray('2x', array(1, 2, 3));
+		$this->assertFalse($res);
+	}
+
+	public function testTypeCast() {
+		$res = Utility::typeCast(2, 'string');
+		$this->assertNotSame(2, $res);
+		$this->assertSame('2', $res);
+	}
+
+	public function testGetClientIp() {
+		$res = Utility::getClientIp();
+		$this->assertEquals(env('REMOTE_ADDR'), $res);
+	}
+
+	public function testGetReferer() {
+		$res = Utility::getReferer();
+		//$this->assertTrue(env(''), $res);
+		$this->assertEquals(env('HTTP_REFERER'), $res);
+	}
+
+	public function testGetHeaderFromUrl() {
+		$res = Utility::getHeaderFromUrl('http://www.spiegel.de');
+		$this->assertTrue(is_array($res) && count($res) > 10);
+		$this->assertEquals('HTTP/1.0 200 OK', $res[0]);
+	}
+
+	public function testAutoPrefixUrl() {
+		$res = Utility::autoPrefixUrl('www.spiegel.de');
+		$this->assertEquals('http://www.spiegel.de', $res);
+	}
+
+	public function testCleanUrl() {
+		$res = Utility::cleanUrl('www.spiegel.de');
+		$this->assertEquals('http://www.spiegel.de', $res);
+
+		$res = Utility::cleanUrl('http://');
+		$this->assertEquals('', $res);
+
+		$res = Utility::cleanUrl('http://www');
+		$this->assertEquals('', $res);
+
+		$res = Utility::cleanUrl('spiegel.de');
+		$this->assertEquals('http://spiegel.de', $res);
+
+		$res = Utility::cleanUrl('spiegel.de', true);
+		echo returns($res);
+		$this->assertEquals('http://www.spiegel.de', $res);
+	}
+
+	public function testDeep() {
+		$is = array(
+			'f some',
+			'e 49r ' => 'rf r ',
+			'er' => array(array('ee'=>array('rr '=>' tt ')))
+		);
+		$expected = array(
+			'f some',
+			'e 49r ' => 'rf r',
+			'er' => array(array('ee'=>array('rr '=>'tt')))
+		);
+		//$this->assertSame($is, $expected);
+
+		$res = Utility::trimDeep($is);
+		$this->assertSame($res, $expected);
+
+		//$res = CommonComponent::trimDeep($is);
+		//$this->assertSame($res, $expected);
+	}
+
+	//TODO: move to boostrap
+	public function _testDeepFunction() {
+		$is = array(
+			'f some',
+			'e 49r ' => 'rf r ',
+			'er' => array(array('ee'=>array('rr '=>' tt ')))
+		);
+		$expected = array(
+			'f some',
+			'e 49r ' => 'rf r',
+			'er' => array(array('ee'=>array('rr '=>'tt')))
+		);
+
+		$res = Utility::deep('trim', $is);
+		$this->assertSame($res, $expected);
+
+	}
+
+	public function testArrayFlatten() {
+		$array=array(
+			'a' => 1,
+			'b' => array('c'=>array('d'=>array('f'=>'g', 'h'=>true))),
+			'k' => 'm',
+		);
+		$res = Utility::arrayFlatten($array);
+
+		$expected = array(
+			'a' => 1,
+			'f' => 'g',
+			'h'=> true,
+			'k' => 'm',
+		);
+		$this->assertSame($expected, $res);
+	}
+
+	public function testArrayShiftKeys() {
+		$array=array(
+			'a' => 1,
+			'b' => array('c'=>array('d'=>array('f'=>'g', 'h'=>true))),
+			'k' => 'm',
+		);
+		$res = Utility::arrayShiftKeys($array);
+
+		$expected = 'a';
+		$this->assertSame($expected, $res);
+		$expected = array(
+			'b' => array('c'=>array('d'=>array('f'=>'g', 'h'=>true))),
+			'k' => 'm',
+		);
+		$this->assertSame($expected, $array);
+	}
+
+	public function testTime() {
+		Utility::startClock();
+		time_nanosleep(0, 200000000);
+		$res = Utility::returnElapsedTime();
+		$this->assertTrue(round($res, 1) === 0.2);
+
+		time_nanosleep(0, 100000000);
+		$res = Utility::returnElapsedTime(8, true);
+		$this->assertTrue(round($res, 1) === 0.3);
+
+		time_nanosleep(0, 100000000);
+		$res = Utility::returnElapsedTime();
+		$this->assertTrue(round($res, 1) === 0.1);
+	}
+
+	public function testLogicalAnd() {
+		$array=array(
+			'a' => 1,
+			'b' => 1,
+			'c' => 0,
+			'd' => 1,
+		);
+		$is = Utility::logicalAnd($array);
+		$this->assertSame($is, false);
+
+		$array=array(
+			'a' => 1,
+			'b' => 1,
+			'c' => 1,
+			'd' => 1,
+		);
+		$is = Utility::logicalAnd($array);
+		$this->assertSame($is, true);
+	}
+
+
+
+	public function testLogicalOr() {
+		$array=array(
+			'a' => 0,
+			'b' => 1,
+			'c' => 0,
+			'd' => 1,
+		);
+		$is = Utility::logicalOr($array);
+		$this->assertSame($is, true);
+
+		$array=array(
+			'a' => 1,
+			'b' => 1,
+			'c' => 1,
+			'd' => 1,
+		);
+		$is = Utility::logicalOr($array);
+		$this->assertSame($is, true);
+
+
+		$array=array(
+			'a' => 0,
+			'b' => 0,
+			'c' => 0,
+			'd' => 0,
+		);
+		$is = Utility::logicalOr($array);
+		$this->assertSame($is, false);
+
+
+
+	}
+
+
+
+
+}