[Pkg-owncloud-commits] [owncloud] 135/199: Use "file size" instead of "filesize", then also apply camel case.

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:18 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ea246d058ed86acc6634d34888d61f2a953e6ce1
Author: Andreas Fischer <bantu at owncloud.com>
Date:   Sun Mar 16 19:54:05 2014 +0100

    Use "file size" instead of "filesize", then also apply camel case.
---
 lib/private/largefilehelper.php          | 48 ++++++++++++++++----------------
 tests/lib/largefilehelpergetfilesize.php | 32 ++++++++++-----------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/lib/private/largefilehelper.php b/lib/private/largefilehelper.php
index 3d15e78..4bab197 100644
--- a/lib/private/largefilehelper.php
+++ b/lib/private/largefilehelper.php
@@ -62,7 +62,7 @@ class LargeFileHelper {
 	}
 
 	/**
-	* @brief Tries to get the filesize of a file via various workarounds that
+	* @brief Tries to get the size of a file via various workarounds that
 	*        even work for large files on 32-bit platforms.
 	*
 	* @param string $filename Path to the file.
@@ -70,31 +70,31 @@ class LargeFileHelper {
 	* @return null|int|float Number of bytes as number (float or int) or
 	*                        null on failure.
 	*/
-	public function getFilesize($filename) {
-		$filesize = $this->getFilesizeViaCurl($filename);
-		if (!is_null($filesize)) {
-			return $filesize;
+	public function getFileSize($filename) {
+		$fileSize = $this->getFileSizeViaCurl($filename);
+		if (!is_null($fileSize)) {
+			return $fileSize;
 		}
-		$filesize = $this->getFilesizeViaCOM($filename);
-		if (!is_null($filesize)) {
-			return $filesize;
+		$fileSize = $this->getFileSizeViaCOM($filename);
+		if (!is_null($fileSize)) {
+			return $fileSize;
 		}
-		$filesize = $this->getFilesizeViaExec($filename);
-		if (!is_null($filesize)) {
-			return $filesize;
+		$fileSize = $this->getFileSizeViaExec($filename);
+		if (!is_null($fileSize)) {
+			return $fileSize;
 		}
-		return $this->getFilesizeNative($filename);
+		return $this->getFileSizeNative($filename);
 	}
 
 	/**
-	* @brief Tries to get the filesize of a file via a CURL HEAD request.
+	* @brief Tries to get the size of a file via a CURL HEAD request.
 	*
 	* @param string $filename Path to the file.
 	*
 	* @return null|int|float Number of bytes as number (float or int) or
 	*                        null on failure.
 	*/
-	public function getFilesizeViaCurl($filename) {
+	public function getFileSizeViaCurl($filename) {
 		if (function_exists('curl_init')) {
 			$ch = curl_init("file://$filename");
 			curl_setopt($ch, CURLOPT_NOBODY, true);
@@ -114,14 +114,14 @@ class LargeFileHelper {
 	}
 
 	/**
-	* @brief Tries to get the filesize of a file via the Windows DOM extension.
+	* @brief Tries to get the size of a file via the Windows DOM extension.
 	*
 	* @param string $filename Path to the file.
 	*
 	* @return null|int|float Number of bytes as number (float or int) or
 	*                        null on failure.
 	*/
-	public function getFilesizeViaCOM($filename) {
+	public function getFileSizeViaCOM($filename) {
 		if (class_exists('COM')) {
 			$fsobj = new \COM("Scripting.FileSystemObject");
 			$file = $fsobj->GetFile($filename);
@@ -131,14 +131,14 @@ class LargeFileHelper {
 	}
 
 	/**
-	* @brief Tries to get the filesize of a file via an exec() call.
+	* @brief Tries to get the size of a file via an exec() call.
 	*
 	* @param string $filename Path to the file.
 	*
 	* @return null|int|float Number of bytes as number (float or int) or
 	*                        null on failure.
 	*/
-	public function getFilesizeViaExec($filename) {
+	public function getFileSizeViaExec($filename) {
 		if (\OC_Helper::is_function_enabled('exec')) {
 			$os = strtolower(php_uname('s'));
 			$arg = escapeshellarg($filename);
@@ -160,19 +160,19 @@ class LargeFileHelper {
 	}
 
 	/**
-	* @brief Gets the filesize via a filesize() call and converts negative
-	*        signed int to positive float. As the result of filesize() will
-	*        wrap around after a filesize of 2^32 bytes = 4 GiB, this should
-	*        only be used as a last resort.
+	* @brief Gets the size of a file via a filesize() call and converts
+	*        negative signed int to positive float. As the result of filesize()
+	*        will wrap around after a file size of 2^32 bytes = 4 GiB, this
+	*        should only be used as a last resort.
 	*
 	* @param string $filename Path to the file.
 	*
 	* @return int|float Number of bytes as number (float or int).
 	*/
-	public function getFilesizeNative($filename) {
+	public function getFileSizeNative($filename) {
 		$result = filesize($filename);
 		if ($result < 0) {
-			// For filesizes between 2 GiB and 4 GiB, filesize() will return a
+			// For file sizes between 2 GiB and 4 GiB, filesize() will return a
 			// negative int, as the PHP data type int is signed. Interpret the
 			// returned int as an unsigned integer and put it into a float.
 			return (float) sprintf('%u', $result);
diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/largefilehelpergetfilesize.php
index 699dd68..cc25d54 100644
--- a/tests/lib/largefilehelpergetfilesize.php
+++ b/tests/lib/largefilehelpergetfilesize.php
@@ -9,61 +9,61 @@
 namespace Test;
 
 /**
-* Tests whether LargeFileHelper is able to determine filesize at all.
+* Tests whether LargeFileHelper is able to determine file size at all.
 * Large files are not considered yet.
 */
-class LargeFileHelperGetFilesize extends \PHPUnit_Framework_TestCase {
+class LargeFileHelperGetFileSize extends \PHPUnit_Framework_TestCase {
 	protected $filename;
-	protected $filesize;
+	protected $fileSize;
 	protected $helper;
 
 	public function setUp() {
 		parent::setUp();
 		$this->filename = __DIR__ . '/../data/data.tar.gz';
-		$this->filesize = 4195;
+		$this->fileSize = 4195;
 		$this->helper = new \OC\LargeFileHelper;
 	}
 
-	public function testGetFilesizeViaCurl() {
+	public function testGetFileSizeViaCurl() {
 		if (!extension_loaded('curl')) {
 			$this->markTestSkipped(
 				'The PHP curl extension is required for this test.'
 			);
 		}
 		$this->assertSame(
-			$this->filesize,
-			$this->helper->getFilesizeViaCurl($this->filename)
+			$this->fileSize,
+			$this->helper->getFileSizeViaCurl($this->filename)
 		);
 	}
 
-	public function testGetFilesizeViaCOM() {
+	public function testGetFileSizeViaCOM() {
 		if (!extension_loaded('COM')) {
 			$this->markTestSkipped(
 				'The PHP Windows COM extension is required for this test.'
 			);
 		}
 		$this->assertSame(
-			$this->filesize,
-			$this->helper->getFilesizeViaDOM($this->filename)
+			$this->fileSize,
+			$this->helper->getFileSizeViaDOM($this->filename)
 		);
 	}
 
-	public function testGetFilesizeViaExec() {
+	public function testGetFileSizeViaExec() {
 		if (!\OC_Helper::is_function_enabled('exec')) {
 			$this->markTestSkipped(
 				'The exec() function needs to be enabled for this test.'
 			);
 		}
 		$this->assertSame(
-			$this->filesize,
-			$this->helper->getFilesizeViaExec($this->filename)
+			$this->fileSize,
+			$this->helper->getFileSizeViaExec($this->filename)
 		);
 	}
 
-	public function testGetFilesizeNative() {
+	public function testGetFileSizeNative() {
 		$this->assertSame(
-			$this->filesize,
-			$this->helper->getFilesizeNative($this->filename)
+			$this->fileSize,
+			$this->helper->getFileSizeNative($this->filename)
 		);
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list