Merge pull request #5844 from nextcloud/phpstorm_inspect2

More phpstorm inspection fixes
This commit is contained in:
Morris Jobke 2017-07-24 13:54:30 +02:00 committed by GitHub
commit 5bc0edbd29
29 changed files with 99 additions and 99 deletions

View File

@ -588,7 +588,7 @@ class Manager implements IManager {
$users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token); $users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
if (sizeof($users) !== 1) { if (count($users) !== 1) {
// No unique user found // No unique user found
throw new \UnexpectedValueException('The token is invalid'); throw new \UnexpectedValueException('The token is invalid');
} }

View File

@ -409,7 +409,7 @@ class AllConfig implements \OCP\IConfig {
array_unshift($queryParams, $key); array_unshift($queryParams, $key);
array_unshift($queryParams, $appName); array_unshift($queryParams, $appName);
$placeholders = (sizeof($chunk) == 50) ? $placeholders50 : implode(',', array_fill(0, sizeof($chunk), '?')); $placeholders = (count($chunk) === 50) ? $placeholders50 : implode(',', array_fill(0, count($chunk), '?'));
$query = 'SELECT `userid`, `configvalue` ' . $query = 'SELECT `userid`, `configvalue` ' .
'FROM `*PREFIX*preferences` ' . 'FROM `*PREFIX*preferences` ' .

View File

@ -43,7 +43,7 @@ class DependencyAnalyzer {
* @param Platform $platform * @param Platform $platform
* @param \OCP\IL10N $l * @param \OCP\IL10N $l
*/ */
function __construct(Platform $platform, IL10N $l) { public function __construct(Platform $platform, IL10N $l) {
$this->platform = $platform; $this->platform = $platform;
$this->l = $l; $this->l = $l;
} }
@ -179,7 +179,7 @@ class DependencyAnalyzer {
}, $supportedDatabases); }, $supportedDatabases);
$currentDatabase = $this->platform->getDatabase(); $currentDatabase = $this->platform->getDatabase();
if (!in_array($currentDatabase, $supportedDatabases)) { if (!in_array($currentDatabase, $supportedDatabases)) {
$missing[] = (string)$this->l->t('Following databases are supported: %s', join(', ', $supportedDatabases)); $missing[] = (string)$this->l->t('Following databases are supported: %s', implode(', ', $supportedDatabases));
} }
return $missing; return $missing;
} }
@ -282,7 +282,7 @@ class DependencyAnalyzer {
} }
$currentOS = $this->platform->getOS(); $currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) { if (!in_array($currentOS, $oss)) {
$missing[] = (string)$this->l->t('Following platforms are supported: %s', join(', ', $oss)); $missing[] = (string)$this->l->t('Following platforms are supported: %s', implode(', ', $oss));
} }
return $missing; return $missing;
} }
@ -349,8 +349,9 @@ class DependencyAnalyzer {
* @return mixed * @return mixed
*/ */
private function getValue($element) { private function getValue($element) {
if (isset($element['@value'])) if (isset($element['@value'])) {
return $element['@value']; return $element['@value'];
}
return (string)$element; return (string)$element;
} }
} }

View File

@ -176,7 +176,7 @@ class InfoParser {
* @param \SimpleXMLElement $xml * @param \SimpleXMLElement $xml
* @return array * @return array
*/ */
function xmlToArray($xml) { public function xmlToArray($xml) {
if (!$xml->children()) { if (!$xml->children()) {
return (string)$xml; return (string)$xml;
} }

View File

@ -315,7 +315,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated implements only deprecated methods * @deprecated implements only deprecated methods
* @return IApi * @return IApi
*/ */
function getCoreApi() public function getCoreApi()
{ {
return $this->query('API'); return $this->query('API');
} }
@ -323,7 +323,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
/** /**
* @return \OCP\IServerContainer * @return \OCP\IServerContainer
*/ */
function getServer() public function getServer()
{ {
return $this->server; return $this->server;
} }
@ -332,7 +332,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param string $middleWare * @param string $middleWare
* @return boolean|null * @return boolean|null
*/ */
function registerMiddleWare($middleWare) { public function registerMiddleWare($middleWare) {
array_push($this->middleWares, $middleWare); array_push($this->middleWares, $middleWare);
} }
@ -340,7 +340,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* used to return the appname of the set application * used to return the appname of the set application
* @return string the name of your application * @return string the name of your application
*/ */
function getAppName() { public function getAppName() {
return $this->query('AppName'); return $this->query('AppName');
} }
@ -348,7 +348,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated use IUserSession->isLoggedIn() * @deprecated use IUserSession->isLoggedIn()
* @return boolean * @return boolean
*/ */
function isLoggedIn() { public function isLoggedIn() {
return \OC::$server->getUserSession()->isLoggedIn(); return \OC::$server->getUserSession()->isLoggedIn();
} }
@ -356,7 +356,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @deprecated use IGroupManager->isAdmin($userId) * @deprecated use IGroupManager->isAdmin($userId)
* @return boolean * @return boolean
*/ */
function isAdminUser() { public function isAdminUser() {
$uid = $this->getUserId(); $uid = $this->getUserId();
return \OC_User::isAdminUser($uid); return \OC_User::isAdminUser($uid);
} }
@ -371,7 +371,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param string $level * @param string $level
* @return mixed * @return mixed
*/ */
function log($message, $level) { public function log($message, $level) {
switch($level){ switch($level){
case 'debug': case 'debug':
$level = \OCP\Util::DEBUG; $level = \OCP\Util::DEBUG;

View File

@ -36,100 +36,100 @@ abstract class Archive {
/** /**
* @param $source * @param $source
*/ */
abstract function __construct($source); public abstract function __construct($source);
/** /**
* add an empty folder to the archive * add an empty folder to the archive
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
abstract function addFolder($path); public abstract function addFolder($path);
/** /**
* add a file to the archive * add a file to the archive
* @param string $path * @param string $path
* @param string $source either a local file or string data * @param string $source either a local file or string data
* @return bool * @return bool
*/ */
abstract function addFile($path, $source=''); public abstract function addFile($path, $source='');
/** /**
* rename a file or folder in the archive * rename a file or folder in the archive
* @param string $source * @param string $source
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
abstract function rename($source, $dest); public abstract function rename($source, $dest);
/** /**
* get the uncompressed size of a file in the archive * get the uncompressed size of a file in the archive
* @param string $path * @param string $path
* @return int * @return int
*/ */
abstract function filesize($path); public abstract function filesize($path);
/** /**
* get the last modified time of a file in the archive * get the last modified time of a file in the archive
* @param string $path * @param string $path
* @return int * @return int
*/ */
abstract function mtime($path); public abstract function mtime($path);
/** /**
* get the files in a folder * get the files in a folder
* @param string $path * @param string $path
* @return array * @return array
*/ */
abstract function getFolder($path); public abstract function getFolder($path);
/** /**
* get all files in the archive * get all files in the archive
* @return array * @return array
*/ */
abstract function getFiles(); public abstract function getFiles();
/** /**
* get the content of a file * get the content of a file
* @param string $path * @param string $path
* @return string * @return string
*/ */
abstract function getFile($path); public abstract function getFile($path);
/** /**
* extract a single file from the archive * extract a single file from the archive
* @param string $path * @param string $path
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
abstract function extractFile($path, $dest); public abstract function extractFile($path, $dest);
/** /**
* extract the archive * extract the archive
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
abstract function extract($dest); public abstract function extract($dest);
/** /**
* check if a file or folder exists in the archive * check if a file or folder exists in the archive
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
abstract function fileExists($path); public abstract function fileExists($path);
/** /**
* remove a file or folder from the archive * remove a file or folder from the archive
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
abstract function remove($path); public abstract function remove($path);
/** /**
* get a file handler * get a file handler
* @param string $path * @param string $path
* @param string $mode * @param string $mode
* @return resource * @return resource
*/ */
abstract function getStream($path, $mode); public abstract function getStream($path, $mode);
/** /**
* add a folder and all its content * add a folder and all its content
* @param string $path * @param string $path
* @param string $source * @param string $source
* @return boolean|null * @return boolean|null
*/ */
function addRecursive($path, $source) { public function addRecursive($path, $source) {
$dh = opendir($source); $dh = opendir($source);
if(is_resource($dh)) { if(is_resource($dh)) {
$this->addFolder($path); $this->addFolder($path);
while (($file = readdir($dh)) !== false) { while (($file = readdir($dh)) !== false) {
if($file=='.' or $file=='..') { if($file === '.' || $file === '..') {
continue; continue;
} }
if(is_dir($source.'/'.$file)) { if(is_dir($source.'/'.$file)) {

View File

@ -52,7 +52,7 @@ class TAR extends Archive {
/** /**
* @param string $source * @param string $source
*/ */
function __construct($source) { public function __construct($source) {
$types = array(null, 'gz', 'bz2'); $types = array(null, 'gz', 'bz2');
$this->path = $source; $this->path = $source;
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]); $this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
@ -90,7 +90,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function addFolder($path) { public function addFolder($path) {
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder(); $tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
if (substr($path, -1, 1) != '/') { if (substr($path, -1, 1) != '/') {
$path .= '/'; $path .= '/';
@ -120,7 +120,7 @@ class TAR extends Archive {
* @param string $source either a local file or string data * @param string $source either a local file or string data
* @return bool * @return bool
*/ */
function addFile($path, $source = '') { public function addFile($path, $source = '') {
if ($this->fileExists($path)) { if ($this->fileExists($path)) {
$this->remove($path); $this->remove($path);
} }
@ -140,7 +140,7 @@ class TAR extends Archive {
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
function rename($source, $dest) { public function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive //no proper way to delete, rename entire archive, rename file and remake archive
$tmp = \OCP\Files::tmpFolder(); $tmp = \OCP\Files::tmpFolder();
$this->tar->extract($tmp); $this->tar->extract($tmp);
@ -180,7 +180,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return int * @return int
*/ */
function filesize($path) { public function filesize($path) {
$stat = $this->getHeader($path); $stat = $this->getHeader($path);
return $stat['size']; return $stat['size'];
} }
@ -191,7 +191,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return int * @return int
*/ */
function mtime($path) { public function mtime($path) {
$stat = $this->getHeader($path); $stat = $this->getHeader($path);
return $stat['mtime']; return $stat['mtime'];
} }
@ -202,7 +202,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return array * @return array
*/ */
function getFolder($path) { public function getFolder($path) {
$files = $this->getFiles(); $files = $this->getFiles();
$folderContent = array(); $folderContent = array();
$pathLength = strlen($path); $pathLength = strlen($path);
@ -228,7 +228,7 @@ class TAR extends Archive {
* *
* @return array * @return array
*/ */
function getFiles() { public function getFiles() {
if ($this->fileList) { if ($this->fileList) {
return $this->fileList; return $this->fileList;
} }
@ -249,7 +249,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return string * @return string
*/ */
function getFile($path) { public function getFile($path) {
return $this->tar->extractInString($path); return $this->tar->extractInString($path);
} }
@ -260,7 +260,7 @@ class TAR extends Archive {
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
function extractFile($path, $dest) { public function extractFile($path, $dest) {
$tmp = \OCP\Files::tmpFolder(); $tmp = \OCP\Files::tmpFolder();
if (!$this->fileExists($path)) { if (!$this->fileExists($path)) {
return false; return false;
@ -283,7 +283,7 @@ class TAR extends Archive {
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
function extract($dest) { public function extract($dest) {
return $this->tar->extract($dest); return $this->tar->extract($dest);
} }
@ -293,7 +293,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function fileExists($path) { public function fileExists($path) {
$files = $this->getFiles(); $files = $this->getFiles();
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) { if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
return true; return true;
@ -322,7 +322,7 @@ class TAR extends Archive {
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function remove($path) { public function remove($path) {
if (!$this->fileExists($path)) { if (!$this->fileExists($path)) {
return false; return false;
} }
@ -346,7 +346,7 @@ class TAR extends Archive {
* @param string $mode * @param string $mode
* @return resource * @return resource
*/ */
function getStream($path, $mode) { public function getStream($path, $mode) {
if (strrpos($path, '.') !== false) { if (strrpos($path, '.') !== false) {
$ext = substr($path, strrpos($path, '.')); $ext = substr($path, strrpos($path, '.'));
} else { } else {
@ -371,7 +371,7 @@ class TAR extends Archive {
/** /**
* write back temporary files * write back temporary files
*/ */
function writeBack($tmpFile, $path) { public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile); $this->addFile($path, $tmpFile);
unlink($tmpFile); unlink($tmpFile);
} }

View File

@ -43,7 +43,7 @@ class ZIP extends Archive{
/** /**
* @param string $source * @param string $source
*/ */
function __construct($source) { public function __construct($source) {
$this->path=$source; $this->path=$source;
$this->zip=new \ZipArchive(); $this->zip=new \ZipArchive();
if($this->zip->open($source, \ZipArchive::CREATE)) { if($this->zip->open($source, \ZipArchive::CREATE)) {
@ -56,7 +56,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function addFolder($path) { public function addFolder($path) {
return $this->zip->addEmptyDir($path); return $this->zip->addEmptyDir($path);
} }
/** /**
@ -65,7 +65,7 @@ class ZIP extends Archive{
* @param string $source either a local file or string data * @param string $source either a local file or string data
* @return bool * @return bool
*/ */
function addFile($path, $source='') { public function addFile($path, $source='') {
if($source and $source[0]=='/' and file_exists($source)) { if($source and $source[0]=='/' and file_exists($source)) {
$result=$this->zip->addFile($source, $path); $result=$this->zip->addFile($source, $path);
}else{ }else{
@ -83,7 +83,7 @@ class ZIP extends Archive{
* @param string $dest * @param string $dest
* @return boolean|null * @return boolean|null
*/ */
function rename($source, $dest) { public function rename($source, $dest) {
$source=$this->stripPath($source); $source=$this->stripPath($source);
$dest=$this->stripPath($dest); $dest=$this->stripPath($dest);
$this->zip->renameName($source, $dest); $this->zip->renameName($source, $dest);
@ -93,7 +93,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return int * @return int
*/ */
function filesize($path) { public function filesize($path) {
$stat=$this->zip->statName($path); $stat=$this->zip->statName($path);
return $stat['size']; return $stat['size'];
} }
@ -102,7 +102,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return int * @return int
*/ */
function mtime($path) { public function mtime($path) {
return filemtime($this->path); return filemtime($this->path);
} }
/** /**
@ -110,7 +110,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return array * @return array
*/ */
function getFolder($path) { public function getFolder($path) {
$files=$this->getFiles(); $files=$this->getFiles();
$folderContent=array(); $folderContent=array();
$pathLength=strlen($path); $pathLength=strlen($path);
@ -127,7 +127,7 @@ class ZIP extends Archive{
* get all files in the archive * get all files in the archive
* @return array * @return array
*/ */
function getFiles() { public function getFiles() {
$fileCount=$this->zip->numFiles; $fileCount=$this->zip->numFiles;
$files=array(); $files=array();
for($i=0;$i<$fileCount;$i++) { for($i=0;$i<$fileCount;$i++) {
@ -140,7 +140,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return string * @return string
*/ */
function getFile($path) { public function getFile($path) {
return $this->zip->getFromName($path); return $this->zip->getFromName($path);
} }
/** /**
@ -149,7 +149,7 @@ class ZIP extends Archive{
* @param string $dest * @param string $dest
* @return boolean|null * @return boolean|null
*/ */
function extractFile($path, $dest) { public function extractFile($path, $dest) {
$fp = $this->zip->getStream($path); $fp = $this->zip->getStream($path);
file_put_contents($dest, $fp); file_put_contents($dest, $fp);
} }
@ -158,7 +158,7 @@ class ZIP extends Archive{
* @param string $dest * @param string $dest
* @return bool * @return bool
*/ */
function extract($dest) { public function extract($dest) {
return $this->zip->extractTo($dest); return $this->zip->extractTo($dest);
} }
/** /**
@ -166,7 +166,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function fileExists($path) { public function fileExists($path) {
return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false); return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
} }
/** /**
@ -174,7 +174,7 @@ class ZIP extends Archive{
* @param string $path * @param string $path
* @return bool * @return bool
*/ */
function remove($path) { public function remove($path) {
if($this->fileExists($path.'/')) { if($this->fileExists($path.'/')) {
return $this->zip->deleteName($path.'/'); return $this->zip->deleteName($path.'/');
}else{ }else{
@ -187,7 +187,7 @@ class ZIP extends Archive{
* @param string $mode * @param string $mode
* @return resource * @return resource
*/ */
function getStream($path, $mode) { public function getStream($path, $mode) {
if($mode=='r' or $mode=='rb') { if($mode=='r' or $mode=='rb') {
return $this->zip->getStream($path); return $this->zip->getStream($path);
} else { } else {
@ -213,7 +213,7 @@ class ZIP extends Archive{
/** /**
* write back temporary files * write back temporary files
*/ */
function writeBack($tmpFile, $path) { public function writeBack($tmpFile, $path) {
$this->addFile($path, $tmpFile); $this->addFile($path, $tmpFile);
unlink($tmpFile); unlink($tmpFile);
} }

View File

@ -82,7 +82,6 @@ class DefaultTokenMapper extends Mapper {
if ($data === false) { if ($data === false) {
throw new DoesNotExistException('token does not exist'); throw new DoesNotExistException('token does not exist');
} }
;
return DefaultToken::fromRow($data); return DefaultToken::fromRow($data);
} }
@ -105,7 +104,7 @@ class DefaultTokenMapper extends Mapper {
$result->closeCursor(); $result->closeCursor();
if ($data === false) { if ($data === false) {
throw new DoesNotExistException('token does not exist'); throw new DoesNotExistException('token does not exist');
}; }
return DefaultToken::fromRow($data); return DefaultToken::fromRow($data);
} }

View File

@ -45,7 +45,7 @@ class AsyncBus implements IBus {
/** /**
* @param \OCP\BackgroundJob\IJobList $jobList * @param \OCP\BackgroundJob\IJobList $jobList
*/ */
function __construct($jobList) { public function __construct($jobList) {
$this->jobList = $jobList; $this->jobList = $jobList;
} }

View File

@ -39,7 +39,7 @@ class S3 implements IObjectStore {
* @return string the container or bucket name where objects are stored * @return string the container or bucket name where objects are stored
* @since 7.0.0 * @since 7.0.0
*/ */
function getStorageId() { public function getStorageId() {
return $this->id; return $this->id;
} }
@ -49,7 +49,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged * @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0 * @since 7.0.0
*/ */
function readObject($urn) { public function readObject($urn) {
// Create the command and serialize the request // Create the command and serialize the request
$request = $this->getConnection()->getCommand('GetObject', [ $request = $this->getConnection()->getCommand('GetObject', [
'Bucket' => $this->bucket, 'Bucket' => $this->bucket,
@ -83,7 +83,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged * @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0 * @since 7.0.0
*/ */
function writeObject($urn, $stream) { public function writeObject($urn, $stream) {
$this->getConnection()->putObject([ $this->getConnection()->putObject([
'Bucket' => $this->bucket, 'Bucket' => $this->bucket,
'Key' => $urn, 'Key' => $urn,
@ -97,7 +97,7 @@ class S3 implements IObjectStore {
* @throws \Exception when something goes wrong, message will be logged * @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0 * @since 7.0.0
*/ */
function deleteObject($urn) { public function deleteObject($urn) {
$this->getConnection()->deleteObject([ $this->getConnection()->deleteObject([
'Bucket' => $this->bucket, 'Bucket' => $this->bucket,
'Key' => $urn 'Key' => $urn

View File

@ -120,7 +120,7 @@ class Mailer implements IMailer {
public function send(Message $message) { public function send(Message $message) {
$debugMode = $this->config->getSystemValue('mail_smtpdebug', false); $debugMode = $this->config->getSystemValue('mail_smtpdebug', false);
if (sizeof($message->getFrom()) === 0) { if (empty($message->getFrom())) {
$message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName()) => $this->defaults->getName()]); $message->setFrom([\OCP\Util::getDefaultEmailAddress($this->defaults->getName()) => $this->defaults->getName()]);
} }
@ -186,7 +186,7 @@ class Mailer implements IMailer {
switch ($this->config->getSystemValue('mail_smtpmode', 'php')) { switch ($this->config->getSystemValue('mail_smtpmode', 'php')) {
case 'smtp': case 'smtp':
$this->instance = $this->getSMTPInstance(); $this->instance = $this->getSmtpInstance();
break; break;
case 'sendmail': case 'sendmail':
// FIXME: Move into the return statement but requires proper testing // FIXME: Move into the return statement but requires proper testing

View File

@ -37,7 +37,7 @@ class Message {
/** /**
* @param Swift_Message $swiftMessage * @param Swift_Message $swiftMessage
*/ */
function __construct(Swift_Message $swiftMessage) { public function __construct(Swift_Message $swiftMessage) {
$this->swiftMessage = $swiftMessage; $this->swiftMessage = $swiftMessage;
} }

View File

@ -97,7 +97,7 @@ class Memcached extends Cache implements IMemcache {
} }
public function get($key) { public function get($key) {
$result = self::$cache->get($this->getNamespace() . $key); $result = self::$cache->get($this->getNameSpace() . $key);
if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) {
return null; return null;
} else { } else {
@ -107,9 +107,9 @@ class Memcached extends Cache implements IMemcache {
public function set($key, $value, $ttl = 0) { public function set($key, $value, $ttl = 0) {
if ($ttl > 0) { if ($ttl > 0) {
$result = self::$cache->set($this->getNamespace() . $key, $value, $ttl); $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
} else { } else {
$result = self::$cache->set($this->getNamespace() . $key, $value); $result = self::$cache->set($this->getNameSpace() . $key, $value);
} }
if ($result !== true) { if ($result !== true) {
$this->verifyReturnCode(); $this->verifyReturnCode();
@ -118,12 +118,12 @@ class Memcached extends Cache implements IMemcache {
} }
public function hasKey($key) { public function hasKey($key) {
self::$cache->get($this->getNamespace() . $key); self::$cache->get($this->getNameSpace() . $key);
return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
} }
public function remove($key) { public function remove($key) {
$result= self::$cache->delete($this->getNamespace() . $key); $result= self::$cache->delete($this->getNameSpace() . $key);
if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) {
$this->verifyReturnCode(); $this->verifyReturnCode();
} }
@ -131,7 +131,7 @@ class Memcached extends Cache implements IMemcache {
} }
public function clear($prefix = '') { public function clear($prefix = '') {
$prefix = $this->getNamespace() . $prefix; $prefix = $this->getNameSpace() . $prefix;
$allKeys = self::$cache->getAllKeys(); $allKeys = self::$cache->getAllKeys();
if ($allKeys === false) { if ($allKeys === false) {
// newer Memcached doesn't like getAllKeys(), flush everything // newer Memcached doesn't like getAllKeys(), flush everything

View File

@ -47,28 +47,28 @@ class XCache extends Cache implements IMemcache {
} }
public function get($key) { public function get($key) {
return xcache_get($this->getNamespace() . $key); return xcache_get($this->getNameSpace() . $key);
} }
public function set($key, $value, $ttl = 0) { public function set($key, $value, $ttl = 0) {
if ($ttl > 0) { if ($ttl > 0) {
return xcache_set($this->getNamespace() . $key, $value, $ttl); return xcache_set($this->getNameSpace() . $key, $value, $ttl);
} else { } else {
return xcache_set($this->getNamespace() . $key, $value); return xcache_set($this->getNameSpace() . $key, $value);
} }
} }
public function hasKey($key) { public function hasKey($key) {
return xcache_isset($this->getNamespace() . $key); return xcache_isset($this->getNameSpace() . $key);
} }
public function remove($key) { public function remove($key) {
return xcache_unset($this->getNamespace() . $key); return xcache_unset($this->getNameSpace() . $key);
} }
public function clear($prefix = '') { public function clear($prefix = '') {
if (function_exists('xcache_unset_by_prefix')) { if (function_exists('xcache_unset_by_prefix')) {
return xcache_unset_by_prefix($this->getNamespace() . $prefix); return xcache_unset_by_prefix($this->getNameSpace() . $prefix);
} else { } else {
// Since we can not clear by prefix, we just clear the whole cache. // Since we can not clear by prefix, we just clear the whole cache.
xcache_clear_cache(\XC_TYPE_VAR, 0); xcache_clear_cache(\XC_TYPE_VAR, 0);

View File

@ -142,7 +142,7 @@ class Manager implements IManager {
$this->notifiersInfo = []; $this->notifiersInfo = [];
foreach ($this->notifiersInfoClosures as $closure) { foreach ($this->notifiersInfoClosures as $closure) {
$notifier = $closure(); $notifier = $closure();
if (!is_array($notifier) || sizeof($notifier) !== 2 || !isset($notifier['id']) || !isset($notifier['name'])) { if (!is_array($notifier) || count($notifier) !== 2 || !isset($notifier['id']) || !isset($notifier['name'])) {
throw new \InvalidArgumentException('The given notifier information is invalid'); throw new \InvalidArgumentException('The given notifier information is invalid');
} }
if (isset($this->notifiersInfo[$notifier['id']])) { if (isset($this->notifiersInfo[$notifier['id']])) {

View File

@ -48,7 +48,7 @@ abstract class Bitmap extends Provider {
try { try {
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY); $bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
} catch (\Exception $e) { } catch (\Exception $e) {
\OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getMessage(), \OCP\Util::ERROR);
return false; return false;
} }

View File

@ -59,7 +59,7 @@ abstract class Office extends Provider {
} catch (\Exception $e) { } catch (\Exception $e) {
unlink($absPath); unlink($absPath);
unlink($pdfPreview); unlink($pdfPreview);
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
return false; return false;
} }

View File

@ -53,7 +53,7 @@ class SVG extends Provider {
$svg->readImageBlob($content); $svg->readImageBlob($content);
$svg->setImageFormat('png32'); $svg->setImageFormat('png32');
} catch (\Exception $e) { } catch (\Exception $e) {
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR); \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
return false; return false;
} }

View File

@ -202,7 +202,7 @@ class CleanTags implements IRepairStep {
} }
if ($repairInfo) { if ($repairInfo) {
$output->info(sprintf($repairInfo, sizeof($orphanItems))); $output->info(sprintf($repairInfo, count($orphanItems)));
} }
} }
} }

View File

@ -37,7 +37,7 @@ class File extends \OCP\Search\Provider {
* @param string $query * @param string $query
* @return \OCP\Search\Result * @return \OCP\Search\Result
*/ */
function search($query) { public function search($query) {
$files = Filesystem::search($query); $files = Filesystem::search($query);
$results = array(); $results = array();
// edit results // edit results

View File

@ -56,7 +56,7 @@ class Crypto implements ICrypto {
* @param IConfig $config * @param IConfig $config
* @param ISecureRandom $random * @param ISecureRandom $random
*/ */
function __construct(IConfig $config, ISecureRandom $random) { public function __construct(IConfig $config, ISecureRandom $random) {
$this->cipher = new AES(); $this->cipher = new AES();
$this->config = $config; $this->config = $config;
$this->random = $random; $this->random = $random;
@ -115,7 +115,7 @@ class Crypto implements ICrypto {
$this->cipher->setPassword($password); $this->cipher->setPassword($password);
$parts = explode('|', $authenticatedCiphertext); $parts = explode('|', $authenticatedCiphertext);
if(sizeof($parts) !== 3) { if(count($parts) !== 3) {
throw new \Exception('Authenticated ciphertext could not be decoded.'); throw new \Exception('Authenticated ciphertext could not be decoded.');
} }

View File

@ -58,7 +58,7 @@ class Hasher implements IHasher {
/** /**
* @param IConfig $config * @param IConfig $config
*/ */
function __construct(IConfig $config) { public function __construct(IConfig $config) {
$this->config = $config; $this->config = $config;
$hashingCost = $this->config->getSystemValue('hashingCost', null); $hashingCost = $this->config->getSystemValue('hashingCost', null);
@ -86,7 +86,7 @@ class Hasher implements IHasher {
*/ */
protected function splitHash($prefixedHash) { protected function splitHash($prefixedHash) {
$explodedString = explode('|', $prefixedHash, 2); $explodedString = explode('|', $prefixedHash, 2);
if(sizeof($explodedString) === 2) { if(count($explodedString) === 2) {
if((int)$explodedString[0] > 0) { if((int)$explodedString[0] > 0) {
return array('version' => (int)$explodedString[0], 'hash' => $explodedString[1]); return array('version' => (int)$explodedString[0], 'hash' => $explodedString[1]);
} }

View File

@ -38,7 +38,7 @@ class TrustedDomainHelper {
/** /**
* @param IConfig $config * @param IConfig $config
*/ */
function __construct(IConfig $config) { public function __construct(IConfig $config) {
$this->config = $config; $this->config = $config;
} }
@ -89,7 +89,7 @@ class TrustedDomainHelper {
if (gettype($trusted) !== 'string') { if (gettype($trusted) !== 'string') {
break; break;
} }
$regex = '/^' . join('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/'; $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/';
if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) { if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) {
return true; return true;
} }

View File

@ -860,7 +860,7 @@ class DefaultShareProvider implements IShareProvider {
if (isset($data['f_permissions'])) { if (isset($data['f_permissions'])) {
$entryData = $data; $entryData = $data;
$entryData['permissions'] = $entryData['f_permissions']; $entryData['permissions'] = $entryData['f_permissions'];
$entryData['parent'] = $entryData['f_parent'];; $entryData['parent'] = $entryData['f_parent'];
$share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData, $share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData,
\OC::$server->getMimeTypeLoader())); \OC::$server->getMimeTypeLoader()));
} }

View File

@ -408,7 +408,7 @@ class SystemTagManager implements ISystemTagManager {
$this->connection->commit(); $this->connection->commit();
} catch (\Exception $e) { } catch (\Exception $e) {
$this->connection->rollback(); $this->connection->rollBack();
throw $e; throw $e;
} }
} }

View File

@ -112,7 +112,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
->andWhere($query->expr()->eq('objecttype', $query->createNamedParameter($objectType))); ->andWhere($query->expr()->eq('objecttype', $query->createNamedParameter($objectType)));
if ($limit) { if ($limit) {
if (sizeof($tagIds) !== 1) { if (count($tagIds) !== 1) {
throw new \InvalidArgumentException('Limit is only allowed with a single tag'); throw new \InvalidArgumentException('Limit is only allowed with a single tag');
} }

View File

@ -256,7 +256,7 @@ class TempManager implements ITempManager {
// suppress any possible errors caused by is_writable // suppress any possible errors caused by is_writable
// checks missing or invalid path or characters, wrong permissions etc // checks missing or invalid path or characters, wrong permissions etc
try { try {
if (is_writeable($directory)) { if (is_writable($directory)) {
return true; return true;
} }
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -1244,7 +1244,7 @@ class OC_App {
$dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
$missing = $dependencyAnalyzer->analyze($info); $missing = $dependencyAnalyzer->analyze($info);
if (!empty($missing)) { if (!empty($missing)) {
$missingMsg = join(PHP_EOL, $missing); $missingMsg = implode(PHP_EOL, $missing);
throw new \Exception( throw new \Exception(
$l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s',
[$info['name'], $missingMsg] [$info['name'], $missingMsg]