diff --git a/FileManager/FileObjectTest.php b/FileManager/FileObjectTest.php index 1e9df26..7c19815 100644 --- a/FileManager/FileObjectTest.php +++ b/FileManager/FileObjectTest.php @@ -13,15 +13,15 @@ class FileObjectTest extends AbstractFileObjectTest { - public function testCreateFromBinary() + public function testcreateFromBuffer() { $test_file = $this->getTestFileByBaseName('photo.jpg'); $binary_file_data = file_get_contents($test_file); $test_name = 'testtttttt'; - $file_object = FileObject::createFromBinary($binary_file_data); - $file_object_with_name = FileObject::createFromBinary($binary_file_data, $test_name); + $file_object = FileObject::createFromBuffer($binary_file_data); + $file_object_with_name = FileObject::createFromBuffer($binary_file_data, $test_name); $this->assertSame(FileObject::DEFAULT_NAME, $file_object->getName()); $this->assertSame($test_name, $file_object_with_name->getName()); @@ -139,7 +139,7 @@ public function testGetResource($file_object) } /** - * @depends testCreateFromBinary + * @depends testcreateFromBuffer */ public function testGetWrapperInfo($file_object) { @@ -154,7 +154,7 @@ public function testGetWrapperInfo($file_object) } /** - * @depends testCreateFromBinary + * @depends testcreateFromBuffer */ public function testIsWrapped($file_object) { @@ -169,7 +169,7 @@ public function testIsWrappedBase64() } /** - * @depends testCreateFromBinary + * @depends testcreateFromBuffer */ public function testIsWrappedHex($file_object) { @@ -183,9 +183,9 @@ public function testGetRaw() $test_text = 'this is a test'; $test_text_mime = 'text/donkey'; - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64_raw = FileObject::createFromBinary(base64_encode($test_text)); - $wrapped_base64_image = FileObject::createFromBinary(file_get_contents($test_file_base64)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64_raw = FileObject::createFromBuffer(base64_encode($test_text)); + $wrapped_base64_image = FileObject::createFromBuffer(file_get_contents($test_file_base64)); $raw_binary = new FileObject($test_file_jpg); $raw_base64 = new FileObject($test_file_base64); $raw_base64_text = new FileObject('data://'. $test_text_mime .';base64,'. base64_encode($test_text)); @@ -208,8 +208,8 @@ public function testGetBase64() $test_text = 'this is a test'; $test_text_mime = 'text/donkey'; - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64_image = FileObject::createFromBinary(file_get_contents($test_file_base64)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64_image = FileObject::createFromBuffer(file_get_contents($test_file_base64)); $raw_binary = new FileObject($test_file_jpg); $raw_base64_text = new FileObject('data://'. $test_text_mime .';base64,'. base64_encode($test_text)); $raw_text = new FileObject('data://'. $test_text_mime .','. $test_text); @@ -230,8 +230,8 @@ public function testGetHash() $test_file_jpg = $this->getTestFileByBaseName('photo.jpg'); $test_file_base64 = $this->getTestFileByBaseName('photo.base64'); - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64)); $raw_binary = new FileObject($test_file_jpg); $raw_base64 = new FileObject($test_file_base64); @@ -247,8 +247,8 @@ public function testGetNameHash() $test_file_jpg = $this->getTestFileByBaseName('photo.jpg'); $test_file_base64 = $this->getTestFileByBaseName('photo.base64'); - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64)); $raw_binary = new FileObject($test_file_jpg); $raw_base64 = new FileObject($test_file_base64); @@ -263,9 +263,9 @@ public function testGetExtension() $test_file_base64 = $this->getTestFileByBaseName('photo.base64'); $test_file_php = __FILE__; - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64)); - $wrapped_binary_php = FileObject::createFromBinary(file_get_contents($test_file_php)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64)); + $wrapped_binary_php = FileObject::createFromBuffer(file_get_contents($test_file_php)); $raw_binary = new FileObject($test_file_jpg); $raw_base64 = new FileObject($test_file_base64); $raw_binary_php = new FileObject($test_file_php); @@ -288,9 +288,9 @@ public function testGetObfuscatedName() $test_file_base64 = $this->getTestFileByBaseName('photo.base64'); $test_file_php = __FILE__; - $wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg)); - $wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64)); - $wrapped_binary_php = FileObject::createFromBinary(file_get_contents($test_file_php)); + $wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg)); + $wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64)); + $wrapped_binary_php = FileObject::createFromBuffer(file_get_contents($test_file_php)); $raw_binary = new FileObject($test_file_jpg); $raw_base64 = new FileObject($test_file_base64); $raw_binary_php = new FileObject($test_file_php); @@ -348,7 +348,7 @@ public function testCustomImageClassConverterWorks() public function testMimeAliases() { $image_file_obj = new FileObject($this->getTestFileByBaseName('photo.jpg')); - $text_file_obj = FileObject::createFromBinary('test and stuff'); + $text_file_obj = FileObject::createFromBuffer('test and stuff'); $this->assertTrue($image_file_obj->isImage()); $this->assertFalse($text_file_obj->isImage()); diff --git a/FileManager/ImageObjectTest.php b/FileManager/ImageObjectTest.php index 430b476..3ab167e 100644 --- a/FileManager/ImageObjectTest.php +++ b/FileManager/ImageObjectTest.php @@ -119,7 +119,7 @@ public function testMultipleFormatCompliance() $test_file_jpg = $this->getTestFileByBaseName('photo.jpg'); $test_file_base64 = $this->getTestFileByBaseName('photo.base64'); - $wrapped_binary = ImageObject::createFromBinary(file_get_contents($test_file_jpg)); + $wrapped_binary = ImageObject::createFromBuffer(file_get_contents($test_file_jpg)); $wrapped_base64 = ImageObject::createFromBase64Encoded(file_get_contents($test_file_base64)); $raw_binary = new ImageObject($test_file_jpg); $raw_base64_text = new ImageObject('data://image/jpeg;base64,'. file_get_contents($test_file_base64)); diff --git a/FileObject.php b/FileObject.php index 90ca41a..9f0f0b2 100644 --- a/FileObject.php +++ b/FileObject.php @@ -143,7 +143,7 @@ public function __construct($filename, $open_mode = 'r', $use_include_path = fal * @access public * @return FileObject */ - public static function createFromBinary($raw_binary_data, $name = null) + public static function createFromBuffer($raw_binary_data, $name = null) { // TODO: Convert to "is_buffer" or "is_binary" once available (PHP 6) if (!is_string($raw_binary_data)) { @@ -176,7 +176,7 @@ public static function createFromBinary($raw_binary_data, $name = null) /** * Create an instance of a FileObject from a base64 encoded string * - * @see FileObject::createFromBinary() + * @see FileObject::createFromBuffer() * @param string $base64_encoded_data * @param string $name * @throws InvalidArgumentException If the "$base64_encoded_data" isn't a string @@ -192,7 +192,7 @@ public static function createFromBase64Encoded($base64_encoded_data, $name = nul $decoded = static::base64Decode($base64_encoded_data); - return static::createFromBinary($decoded, $name); + return static::createFromBuffer($decoded, $name); } /**