Merge pull request #5844 from nextcloud/phpstorm_inspect2
More phpstorm inspection fixes
This commit is contained in:
commit
5bc0edbd29
|
@ -588,7 +588,7 @@ class Manager implements IManager {
|
|||
|
||||
$users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
|
||||
|
||||
if (sizeof($users) !== 1) {
|
||||
if (count($users) !== 1) {
|
||||
// No unique user found
|
||||
throw new \UnexpectedValueException('The token is invalid');
|
||||
}
|
||||
|
|
|
@ -409,7 +409,7 @@ class AllConfig implements \OCP\IConfig {
|
|||
array_unshift($queryParams, $key);
|
||||
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` ' .
|
||||
'FROM `*PREFIX*preferences` ' .
|
||||
|
|
|
@ -43,7 +43,7 @@ class DependencyAnalyzer {
|
|||
* @param Platform $platform
|
||||
* @param \OCP\IL10N $l
|
||||
*/
|
||||
function __construct(Platform $platform, IL10N $l) {
|
||||
public function __construct(Platform $platform, IL10N $l) {
|
||||
$this->platform = $platform;
|
||||
$this->l = $l;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class DependencyAnalyzer {
|
|||
}, $supportedDatabases);
|
||||
$currentDatabase = $this->platform->getDatabase();
|
||||
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;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ class DependencyAnalyzer {
|
|||
}
|
||||
$currentOS = $this->platform->getOS();
|
||||
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;
|
||||
}
|
||||
|
@ -349,8 +349,9 @@ class DependencyAnalyzer {
|
|||
* @return mixed
|
||||
*/
|
||||
private function getValue($element) {
|
||||
if (isset($element['@value']))
|
||||
if (isset($element['@value'])) {
|
||||
return $element['@value'];
|
||||
}
|
||||
return (string)$element;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ class InfoParser {
|
|||
* @param \SimpleXMLElement $xml
|
||||
* @return array
|
||||
*/
|
||||
function xmlToArray($xml) {
|
||||
public function xmlToArray($xml) {
|
||||
if (!$xml->children()) {
|
||||
return (string)$xml;
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @deprecated implements only deprecated methods
|
||||
* @return IApi
|
||||
*/
|
||||
function getCoreApi()
|
||||
public function getCoreApi()
|
||||
{
|
||||
return $this->query('API');
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
/**
|
||||
* @return \OCP\IServerContainer
|
||||
*/
|
||||
function getServer()
|
||||
public function getServer()
|
||||
{
|
||||
return $this->server;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @param string $middleWare
|
||||
* @return boolean|null
|
||||
*/
|
||||
function registerMiddleWare($middleWare) {
|
||||
public function registerMiddleWare($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
|
||||
* @return string the name of your application
|
||||
*/
|
||||
function getAppName() {
|
||||
public function getAppName() {
|
||||
return $this->query('AppName');
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @deprecated use IUserSession->isLoggedIn()
|
||||
* @return boolean
|
||||
*/
|
||||
function isLoggedIn() {
|
||||
public function isLoggedIn() {
|
||||
return \OC::$server->getUserSession()->isLoggedIn();
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @deprecated use IGroupManager->isAdmin($userId)
|
||||
* @return boolean
|
||||
*/
|
||||
function isAdminUser() {
|
||||
public function isAdminUser() {
|
||||
$uid = $this->getUserId();
|
||||
return \OC_User::isAdminUser($uid);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
* @param string $level
|
||||
* @return mixed
|
||||
*/
|
||||
function log($message, $level) {
|
||||
public function log($message, $level) {
|
||||
switch($level){
|
||||
case 'debug':
|
||||
$level = \OCP\Util::DEBUG;
|
||||
|
|
|
@ -36,100 +36,100 @@ abstract class Archive {
|
|||
/**
|
||||
* @param $source
|
||||
*/
|
||||
abstract function __construct($source);
|
||||
public abstract function __construct($source);
|
||||
/**
|
||||
* add an empty folder to the archive
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
abstract function addFolder($path);
|
||||
public abstract function addFolder($path);
|
||||
/**
|
||||
* add a file to the archive
|
||||
* @param string $path
|
||||
* @param string $source either a local file or string data
|
||||
* @return bool
|
||||
*/
|
||||
abstract function addFile($path, $source='');
|
||||
public abstract function addFile($path, $source='');
|
||||
/**
|
||||
* rename a file or folder in the archive
|
||||
* @param string $source
|
||||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
abstract function rename($source, $dest);
|
||||
public abstract function rename($source, $dest);
|
||||
/**
|
||||
* get the uncompressed size of a file in the archive
|
||||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
abstract function filesize($path);
|
||||
public abstract function filesize($path);
|
||||
/**
|
||||
* get the last modified time of a file in the archive
|
||||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
abstract function mtime($path);
|
||||
public abstract function mtime($path);
|
||||
/**
|
||||
* get the files in a folder
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
abstract function getFolder($path);
|
||||
public abstract function getFolder($path);
|
||||
/**
|
||||
* get all files in the archive
|
||||
* @return array
|
||||
*/
|
||||
abstract function getFiles();
|
||||
public abstract function getFiles();
|
||||
/**
|
||||
* get the content of a file
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
abstract function getFile($path);
|
||||
public abstract function getFile($path);
|
||||
/**
|
||||
* extract a single file from the archive
|
||||
* @param string $path
|
||||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
abstract function extractFile($path, $dest);
|
||||
public abstract function extractFile($path, $dest);
|
||||
/**
|
||||
* extract the archive
|
||||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
abstract function extract($dest);
|
||||
public abstract function extract($dest);
|
||||
/**
|
||||
* check if a file or folder exists in the archive
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
abstract function fileExists($path);
|
||||
public abstract function fileExists($path);
|
||||
/**
|
||||
* remove a file or folder from the archive
|
||||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
abstract function remove($path);
|
||||
public abstract function remove($path);
|
||||
/**
|
||||
* get a file handler
|
||||
* @param string $path
|
||||
* @param string $mode
|
||||
* @return resource
|
||||
*/
|
||||
abstract function getStream($path, $mode);
|
||||
public abstract function getStream($path, $mode);
|
||||
/**
|
||||
* add a folder and all its content
|
||||
* @param string $path
|
||||
* @param string $source
|
||||
* @return boolean|null
|
||||
*/
|
||||
function addRecursive($path, $source) {
|
||||
public function addRecursive($path, $source) {
|
||||
$dh = opendir($source);
|
||||
if(is_resource($dh)) {
|
||||
$this->addFolder($path);
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if($file=='.' or $file=='..') {
|
||||
if($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
if(is_dir($source.'/'.$file)) {
|
||||
|
|
|
@ -52,7 +52,7 @@ class TAR extends Archive {
|
|||
/**
|
||||
* @param string $source
|
||||
*/
|
||||
function __construct($source) {
|
||||
public function __construct($source) {
|
||||
$types = array(null, 'gz', 'bz2');
|
||||
$this->path = $source;
|
||||
$this->tar = new \Archive_Tar($source, $types[self::getTarType($source)]);
|
||||
|
@ -90,7 +90,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function addFolder($path) {
|
||||
public function addFolder($path) {
|
||||
$tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||
if (substr($path, -1, 1) != '/') {
|
||||
$path .= '/';
|
||||
|
@ -120,7 +120,7 @@ class TAR extends Archive {
|
|||
* @param string $source either a local file or string data
|
||||
* @return bool
|
||||
*/
|
||||
function addFile($path, $source = '') {
|
||||
public function addFile($path, $source = '') {
|
||||
if ($this->fileExists($path)) {
|
||||
$this->remove($path);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class TAR extends Archive {
|
|||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
function rename($source, $dest) {
|
||||
public function rename($source, $dest) {
|
||||
//no proper way to delete, rename entire archive, rename file and remake archive
|
||||
$tmp = \OCP\Files::tmpFolder();
|
||||
$this->tar->extract($tmp);
|
||||
|
@ -180,7 +180,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
function filesize($path) {
|
||||
public function filesize($path) {
|
||||
$stat = $this->getHeader($path);
|
||||
return $stat['size'];
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
function mtime($path) {
|
||||
public function mtime($path) {
|
||||
$stat = $this->getHeader($path);
|
||||
return $stat['mtime'];
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
function getFolder($path) {
|
||||
public function getFolder($path) {
|
||||
$files = $this->getFiles();
|
||||
$folderContent = array();
|
||||
$pathLength = strlen($path);
|
||||
|
@ -228,7 +228,7 @@ class TAR extends Archive {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFiles() {
|
||||
public function getFiles() {
|
||||
if ($this->fileList) {
|
||||
return $this->fileList;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function getFile($path) {
|
||||
public function getFile($path) {
|
||||
return $this->tar->extractInString($path);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ class TAR extends Archive {
|
|||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
function extractFile($path, $dest) {
|
||||
public function extractFile($path, $dest) {
|
||||
$tmp = \OCP\Files::tmpFolder();
|
||||
if (!$this->fileExists($path)) {
|
||||
return false;
|
||||
|
@ -283,7 +283,7 @@ class TAR extends Archive {
|
|||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
function extract($dest) {
|
||||
public function extract($dest) {
|
||||
return $this->tar->extract($dest);
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function fileExists($path) {
|
||||
public function fileExists($path) {
|
||||
$files = $this->getFiles();
|
||||
if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
|
||||
return true;
|
||||
|
@ -322,7 +322,7 @@ class TAR extends Archive {
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function remove($path) {
|
||||
public function remove($path) {
|
||||
if (!$this->fileExists($path)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ class TAR extends Archive {
|
|||
* @param string $mode
|
||||
* @return resource
|
||||
*/
|
||||
function getStream($path, $mode) {
|
||||
public function getStream($path, $mode) {
|
||||
if (strrpos($path, '.') !== false) {
|
||||
$ext = substr($path, strrpos($path, '.'));
|
||||
} else {
|
||||
|
@ -371,7 +371,7 @@ class TAR extends Archive {
|
|||
/**
|
||||
* write back temporary files
|
||||
*/
|
||||
function writeBack($tmpFile, $path) {
|
||||
public function writeBack($tmpFile, $path) {
|
||||
$this->addFile($path, $tmpFile);
|
||||
unlink($tmpFile);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class ZIP extends Archive{
|
|||
/**
|
||||
* @param string $source
|
||||
*/
|
||||
function __construct($source) {
|
||||
public function __construct($source) {
|
||||
$this->path=$source;
|
||||
$this->zip=new \ZipArchive();
|
||||
if($this->zip->open($source, \ZipArchive::CREATE)) {
|
||||
|
@ -56,7 +56,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function addFolder($path) {
|
||||
public function addFolder($path) {
|
||||
return $this->zip->addEmptyDir($path);
|
||||
}
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ class ZIP extends Archive{
|
|||
* @param string $source either a local file or string data
|
||||
* @return bool
|
||||
*/
|
||||
function addFile($path, $source='') {
|
||||
public function addFile($path, $source='') {
|
||||
if($source and $source[0]=='/' and file_exists($source)) {
|
||||
$result=$this->zip->addFile($source, $path);
|
||||
}else{
|
||||
|
@ -83,7 +83,7 @@ class ZIP extends Archive{
|
|||
* @param string $dest
|
||||
* @return boolean|null
|
||||
*/
|
||||
function rename($source, $dest) {
|
||||
public function rename($source, $dest) {
|
||||
$source=$this->stripPath($source);
|
||||
$dest=$this->stripPath($dest);
|
||||
$this->zip->renameName($source, $dest);
|
||||
|
@ -93,7 +93,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
function filesize($path) {
|
||||
public function filesize($path) {
|
||||
$stat=$this->zip->statName($path);
|
||||
return $stat['size'];
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return int
|
||||
*/
|
||||
function mtime($path) {
|
||||
public function mtime($path) {
|
||||
return filemtime($this->path);
|
||||
}
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
function getFolder($path) {
|
||||
public function getFolder($path) {
|
||||
$files=$this->getFiles();
|
||||
$folderContent=array();
|
||||
$pathLength=strlen($path);
|
||||
|
@ -127,7 +127,7 @@ class ZIP extends Archive{
|
|||
* get all files in the archive
|
||||
* @return array
|
||||
*/
|
||||
function getFiles() {
|
||||
public function getFiles() {
|
||||
$fileCount=$this->zip->numFiles;
|
||||
$files=array();
|
||||
for($i=0;$i<$fileCount;$i++) {
|
||||
|
@ -140,7 +140,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function getFile($path) {
|
||||
public function getFile($path) {
|
||||
return $this->zip->getFromName($path);
|
||||
}
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ class ZIP extends Archive{
|
|||
* @param string $dest
|
||||
* @return boolean|null
|
||||
*/
|
||||
function extractFile($path, $dest) {
|
||||
public function extractFile($path, $dest) {
|
||||
$fp = $this->zip->getStream($path);
|
||||
file_put_contents($dest, $fp);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ class ZIP extends Archive{
|
|||
* @param string $dest
|
||||
* @return bool
|
||||
*/
|
||||
function extract($dest) {
|
||||
public function extract($dest) {
|
||||
return $this->zip->extractTo($dest);
|
||||
}
|
||||
/**
|
||||
|
@ -166,7 +166,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function fileExists($path) {
|
||||
public function fileExists($path) {
|
||||
return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
|
||||
}
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ class ZIP extends Archive{
|
|||
* @param string $path
|
||||
* @return bool
|
||||
*/
|
||||
function remove($path) {
|
||||
public function remove($path) {
|
||||
if($this->fileExists($path.'/')) {
|
||||
return $this->zip->deleteName($path.'/');
|
||||
}else{
|
||||
|
@ -187,7 +187,7 @@ class ZIP extends Archive{
|
|||
* @param string $mode
|
||||
* @return resource
|
||||
*/
|
||||
function getStream($path, $mode) {
|
||||
public function getStream($path, $mode) {
|
||||
if($mode=='r' or $mode=='rb') {
|
||||
return $this->zip->getStream($path);
|
||||
} else {
|
||||
|
@ -213,7 +213,7 @@ class ZIP extends Archive{
|
|||
/**
|
||||
* write back temporary files
|
||||
*/
|
||||
function writeBack($tmpFile, $path) {
|
||||
public function writeBack($tmpFile, $path) {
|
||||
$this->addFile($path, $tmpFile);
|
||||
unlink($tmpFile);
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ class DefaultTokenMapper extends Mapper {
|
|||
if ($data === false) {
|
||||
throw new DoesNotExistException('token does not exist');
|
||||
}
|
||||
;
|
||||
return DefaultToken::fromRow($data);
|
||||
}
|
||||
|
||||
|
@ -105,7 +104,7 @@ class DefaultTokenMapper extends Mapper {
|
|||
$result->closeCursor();
|
||||
if ($data === false) {
|
||||
throw new DoesNotExistException('token does not exist');
|
||||
};
|
||||
}
|
||||
return DefaultToken::fromRow($data);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class AsyncBus implements IBus {
|
|||
/**
|
||||
* @param \OCP\BackgroundJob\IJobList $jobList
|
||||
*/
|
||||
function __construct($jobList) {
|
||||
public function __construct($jobList) {
|
||||
$this->jobList = $jobList;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class S3 implements IObjectStore {
|
|||
* @return string the container or bucket name where objects are stored
|
||||
* @since 7.0.0
|
||||
*/
|
||||
function getStorageId() {
|
||||
public function getStorageId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class S3 implements IObjectStore {
|
|||
* @throws \Exception when something goes wrong, message will be logged
|
||||
* @since 7.0.0
|
||||
*/
|
||||
function readObject($urn) {
|
||||
public function readObject($urn) {
|
||||
// Create the command and serialize the request
|
||||
$request = $this->getConnection()->getCommand('GetObject', [
|
||||
'Bucket' => $this->bucket,
|
||||
|
@ -83,7 +83,7 @@ class S3 implements IObjectStore {
|
|||
* @throws \Exception when something goes wrong, message will be logged
|
||||
* @since 7.0.0
|
||||
*/
|
||||
function writeObject($urn, $stream) {
|
||||
public function writeObject($urn, $stream) {
|
||||
$this->getConnection()->putObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $urn,
|
||||
|
@ -97,7 +97,7 @@ class S3 implements IObjectStore {
|
|||
* @throws \Exception when something goes wrong, message will be logged
|
||||
* @since 7.0.0
|
||||
*/
|
||||
function deleteObject($urn) {
|
||||
public function deleteObject($urn) {
|
||||
$this->getConnection()->deleteObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $urn
|
||||
|
|
|
@ -120,7 +120,7 @@ class Mailer implements IMailer {
|
|||
public function send(Message $message) {
|
||||
$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()]);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ class Mailer implements IMailer {
|
|||
|
||||
switch ($this->config->getSystemValue('mail_smtpmode', 'php')) {
|
||||
case 'smtp':
|
||||
$this->instance = $this->getSMTPInstance();
|
||||
$this->instance = $this->getSmtpInstance();
|
||||
break;
|
||||
case 'sendmail':
|
||||
// FIXME: Move into the return statement but requires proper testing
|
||||
|
|
|
@ -37,7 +37,7 @@ class Message {
|
|||
/**
|
||||
* @param Swift_Message $swiftMessage
|
||||
*/
|
||||
function __construct(Swift_Message $swiftMessage) {
|
||||
public function __construct(Swift_Message $swiftMessage) {
|
||||
$this->swiftMessage = $swiftMessage;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class Memcached extends Cache implements IMemcache {
|
|||
}
|
||||
|
||||
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) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -107,9 +107,9 @@ class Memcached extends Cache implements IMemcache {
|
|||
|
||||
public function set($key, $value, $ttl = 0) {
|
||||
if ($ttl > 0) {
|
||||
$result = self::$cache->set($this->getNamespace() . $key, $value, $ttl);
|
||||
$result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
|
||||
} else {
|
||||
$result = self::$cache->set($this->getNamespace() . $key, $value);
|
||||
$result = self::$cache->set($this->getNameSpace() . $key, $value);
|
||||
}
|
||||
if ($result !== true) {
|
||||
$this->verifyReturnCode();
|
||||
|
@ -118,12 +118,12 @@ class Memcached extends Cache implements IMemcache {
|
|||
}
|
||||
|
||||
public function hasKey($key) {
|
||||
self::$cache->get($this->getNamespace() . $key);
|
||||
self::$cache->get($this->getNameSpace() . $key);
|
||||
return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
|
||||
}
|
||||
|
||||
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) {
|
||||
$this->verifyReturnCode();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class Memcached extends Cache implements IMemcache {
|
|||
}
|
||||
|
||||
public function clear($prefix = '') {
|
||||
$prefix = $this->getNamespace() . $prefix;
|
||||
$prefix = $this->getNameSpace() . $prefix;
|
||||
$allKeys = self::$cache->getAllKeys();
|
||||
if ($allKeys === false) {
|
||||
// newer Memcached doesn't like getAllKeys(), flush everything
|
||||
|
|
|
@ -47,28 +47,28 @@ class XCache extends Cache implements IMemcache {
|
|||
}
|
||||
|
||||
public function get($key) {
|
||||
return xcache_get($this->getNamespace() . $key);
|
||||
return xcache_get($this->getNameSpace() . $key);
|
||||
}
|
||||
|
||||
public function set($key, $value, $ttl = 0) {
|
||||
if ($ttl > 0) {
|
||||
return xcache_set($this->getNamespace() . $key, $value, $ttl);
|
||||
return xcache_set($this->getNameSpace() . $key, $value, $ttl);
|
||||
} else {
|
||||
return xcache_set($this->getNamespace() . $key, $value);
|
||||
return xcache_set($this->getNameSpace() . $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function hasKey($key) {
|
||||
return xcache_isset($this->getNamespace() . $key);
|
||||
return xcache_isset($this->getNameSpace() . $key);
|
||||
}
|
||||
|
||||
public function remove($key) {
|
||||
return xcache_unset($this->getNamespace() . $key);
|
||||
return xcache_unset($this->getNameSpace() . $key);
|
||||
}
|
||||
|
||||
public function clear($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 {
|
||||
// Since we can not clear by prefix, we just clear the whole cache.
|
||||
xcache_clear_cache(\XC_TYPE_VAR, 0);
|
||||
|
|
|
@ -142,7 +142,7 @@ class Manager implements IManager {
|
|||
$this->notifiersInfo = [];
|
||||
foreach ($this->notifiersInfoClosures as $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');
|
||||
}
|
||||
if (isset($this->notifiersInfo[$notifier['id']])) {
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class Bitmap extends Provider {
|
|||
try {
|
||||
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class Office extends Provider {
|
|||
} catch (\Exception $e) {
|
||||
unlink($absPath);
|
||||
unlink($pdfPreview);
|
||||
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class SVG extends Provider {
|
|||
$svg->readImageBlob($content);
|
||||
$svg->setImageFormat('png32');
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ class CleanTags implements IRepairStep {
|
|||
}
|
||||
|
||||
if ($repairInfo) {
|
||||
$output->info(sprintf($repairInfo, sizeof($orphanItems)));
|
||||
$output->info(sprintf($repairInfo, count($orphanItems)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class File extends \OCP\Search\Provider {
|
|||
* @param string $query
|
||||
* @return \OCP\Search\Result
|
||||
*/
|
||||
function search($query) {
|
||||
public function search($query) {
|
||||
$files = Filesystem::search($query);
|
||||
$results = array();
|
||||
// edit results
|
||||
|
|
|
@ -56,7 +56,7 @@ class Crypto implements ICrypto {
|
|||
* @param IConfig $config
|
||||
* @param ISecureRandom $random
|
||||
*/
|
||||
function __construct(IConfig $config, ISecureRandom $random) {
|
||||
public function __construct(IConfig $config, ISecureRandom $random) {
|
||||
$this->cipher = new AES();
|
||||
$this->config = $config;
|
||||
$this->random = $random;
|
||||
|
@ -115,7 +115,7 @@ class Crypto implements ICrypto {
|
|||
$this->cipher->setPassword($password);
|
||||
|
||||
$parts = explode('|', $authenticatedCiphertext);
|
||||
if(sizeof($parts) !== 3) {
|
||||
if(count($parts) !== 3) {
|
||||
throw new \Exception('Authenticated ciphertext could not be decoded.');
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Hasher implements IHasher {
|
|||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
function __construct(IConfig $config) {
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
|
||||
$hashingCost = $this->config->getSystemValue('hashingCost', null);
|
||||
|
@ -86,7 +86,7 @@ class Hasher implements IHasher {
|
|||
*/
|
||||
protected function splitHash($prefixedHash) {
|
||||
$explodedString = explode('|', $prefixedHash, 2);
|
||||
if(sizeof($explodedString) === 2) {
|
||||
if(count($explodedString) === 2) {
|
||||
if((int)$explodedString[0] > 0) {
|
||||
return array('version' => (int)$explodedString[0], 'hash' => $explodedString[1]);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class TrustedDomainHelper {
|
|||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
function __construct(IConfig $config) {
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class TrustedDomainHelper {
|
|||
if (gettype($trusted) !== 'string') {
|
||||
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)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -860,7 +860,7 @@ class DefaultShareProvider implements IShareProvider {
|
|||
if (isset($data['f_permissions'])) {
|
||||
$entryData = $data;
|
||||
$entryData['permissions'] = $entryData['f_permissions'];
|
||||
$entryData['parent'] = $entryData['f_parent'];;
|
||||
$entryData['parent'] = $entryData['f_parent'];
|
||||
$share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData,
|
||||
\OC::$server->getMimeTypeLoader()));
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ class SystemTagManager implements ISystemTagManager {
|
|||
|
||||
$this->connection->commit();
|
||||
} catch (\Exception $e) {
|
||||
$this->connection->rollback();
|
||||
$this->connection->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper {
|
|||
->andWhere($query->expr()->eq('objecttype', $query->createNamedParameter($objectType)));
|
||||
|
||||
if ($limit) {
|
||||
if (sizeof($tagIds) !== 1) {
|
||||
if (count($tagIds) !== 1) {
|
||||
throw new \InvalidArgumentException('Limit is only allowed with a single tag');
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class TempManager implements ITempManager {
|
|||
// suppress any possible errors caused by is_writable
|
||||
// checks missing or invalid path or characters, wrong permissions etc
|
||||
try {
|
||||
if (is_writeable($directory)) {
|
||||
if (is_writable($directory)) {
|
||||
return true;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
@ -1244,7 +1244,7 @@ class OC_App {
|
|||
$dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
|
||||
$missing = $dependencyAnalyzer->analyze($info);
|
||||
if (!empty($missing)) {
|
||||
$missingMsg = join(PHP_EOL, $missing);
|
||||
$missingMsg = implode(PHP_EOL, $missing);
|
||||
throw new \Exception(
|
||||
$l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s',
|
||||
[$info['name'], $missingMsg]
|
||||
|
|
Loading…
Reference in New Issue