Use type casting instead of *val() method
It should be up to 6x faster Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
fe7e726ab2
commit
c1e4f9f305
|
@ -36,7 +36,7 @@ $eventDispatcher->addListener(
|
|||
|
||||
$eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) {
|
||||
$event->addEntityCollection('files', function($name) {
|
||||
$nodes = \OC::$server->getUserFolder()->getById(intval($name));
|
||||
$nodes = \OC::$server->getUserFolder()->getById((int)$name);
|
||||
return !empty($nodes);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -40,6 +40,6 @@ class LimitFilter implements XmlDeserializable {
|
|||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
|
||||
}
|
||||
|
||||
return intval($value);
|
||||
return (int)$value;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,6 @@ class OffsetFilter implements XmlDeserializable {
|
|||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
|
||||
}
|
||||
|
||||
return intval($value);
|
||||
return (int)$value;
|
||||
}
|
||||
}
|
|
@ -97,7 +97,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
$propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) {
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()));
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId());
|
||||
});
|
||||
|
||||
$propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) {
|
||||
|
@ -153,9 +153,9 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
return null;
|
||||
}
|
||||
|
||||
$lastRead = $this->commentsManager->getReadMark('files', strval($node->getId()), $user);
|
||||
$lastRead = $this->commentsManager->getReadMark('files', (string)$node->getId(), $user);
|
||||
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()), $lastRead);
|
||||
return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ abstract class Node implements \Sabre\DAV\INode {
|
|||
throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).');
|
||||
}
|
||||
|
||||
return intval($mtimeFromRequest);
|
||||
return (int)$mtimeFromRequest;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection {
|
|||
$userSession,
|
||||
$groupManager,
|
||||
function($name) {
|
||||
$nodes = \OC::$server->getUserFolder()->getById(intval($name));
|
||||
$nodes = \OC::$server->getUserFolder()->getById((int)$name);
|
||||
return !empty($nodes);
|
||||
}
|
||||
),
|
||||
|
|
|
@ -133,7 +133,7 @@ class Parser {
|
|||
return [
|
||||
'mtime' => strtotime($data['write_time']),
|
||||
'mode' => hexdec(substr($data['attributes'], strpos($data['attributes'], '('), -1)),
|
||||
'size' => isset($data['stream']) ? intval(explode(' ', $data['stream'])[1]) : 0
|
||||
'size' => isset($data['stream']) ? (int)explode(' ', $data['stream'])[1] : 0
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -142,13 +142,13 @@ class Expiration {
|
|||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
|
||||
// Keep for X days but delete anytime if space needed
|
||||
$this->minAge = intval($minValue);
|
||||
$this->minAge = (int)$minValue;
|
||||
$this->maxAge = self::NO_OBLIGATION;
|
||||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
|
||||
// Delete anytime if space needed, Delete all older than max automatically
|
||||
$this->minAge = self::NO_OBLIGATION;
|
||||
$this->maxAge = intval($maxValue);
|
||||
$this->maxAge = (int)$maxValue;
|
||||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
|
||||
// Delete all older than max OR older than min if space needed
|
||||
|
@ -158,8 +158,8 @@ class Expiration {
|
|||
$maxValue = $minValue;
|
||||
}
|
||||
|
||||
$this->minAge = intval($minValue);
|
||||
$this->maxAge = intval($maxValue);
|
||||
$this->minAge = (int)$minValue;
|
||||
$this->maxAge = (int)$maxValue;
|
||||
$this->canPurgeToSaveSpace = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,13 +175,13 @@ class Expiration {
|
|||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
|
||||
// Keep for X days but delete anytime if space needed
|
||||
$this->minAge = intval($minValue);
|
||||
$this->minAge = (int)$minValue;
|
||||
$this->maxAge = self::NO_OBLIGATION;
|
||||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
|
||||
// Delete anytime if space needed, Delete all older than max automatically
|
||||
$this->minAge = self::NO_OBLIGATION;
|
||||
$this->maxAge = intval($maxValue);
|
||||
$this->maxAge = (int)$maxValue;
|
||||
$this->canPurgeToSaveSpace = true;
|
||||
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
|
||||
// Delete all older than max OR older than min if space needed
|
||||
|
@ -191,8 +191,8 @@ class Expiration {
|
|||
$maxValue = $minValue;
|
||||
}
|
||||
|
||||
$this->minAge = intval($minValue);
|
||||
$this->maxAge = intval($maxValue);
|
||||
$this->minAge = (int)$minValue;
|
||||
$this->maxAge = (int)$maxValue;
|
||||
$this->canPurgeToSaveSpace = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ class Storage {
|
|||
|
||||
$toDelete = [];
|
||||
foreach (array_reverse($versions['all']) as $key => $version) {
|
||||
if (intval($version['version'])<$threshold) {
|
||||
if ((int)$version['version'] <$threshold) {
|
||||
$toDelete[$key] = $version;
|
||||
} else {
|
||||
//Versions are sorted by time - nothing mo to iterate.
|
||||
|
|
|
@ -32,7 +32,7 @@ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
|
|||
$serverConnections = $helper->getServerConfigurationPrefixes();
|
||||
sort($serverConnections);
|
||||
$lk = array_pop($serverConnections);
|
||||
$ln = intval(str_replace('s', '', $lk));
|
||||
$ln = (int)str_replace('s', '', $lk);
|
||||
$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$resultData = array('configPrefix' => $nk);
|
||||
|
|
|
@ -109,8 +109,8 @@ class Search extends Command {
|
|||
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
|
||||
$ldapWrapper = new LDAP();
|
||||
|
||||
$offset = intval($input->getOption('offset'));
|
||||
$limit = intval($input->getOption('limit'));
|
||||
$offset = (int)$input->getOption('offset');
|
||||
$limit = (int)$input->getOption('limit');
|
||||
$this->validateOffsetAndLimit($offset, $limit);
|
||||
|
||||
if($input->getOption('group')) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class Connection extends LDAPUtility {
|
|||
$this->doNotValidate = !in_array($this->configPrefix,
|
||||
$helper->getServerConfigurationPrefixes());
|
||||
$this->hasPagedResultSupport =
|
||||
intval($this->configuration->ldapPagingSize) !== 0
|
||||
(int)$this->configuration->ldapPagingSize !== 0
|
||||
|| $this->ldap->hasPagedResultSupport();
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ class Connection extends LDAPUtility {
|
|||
}
|
||||
}
|
||||
|
||||
$backupPort = intval($this->configuration->ldapBackupPort);
|
||||
$backupPort = (int)$this->configuration->ldapBackupPort;
|
||||
if ($backupPort <= 0) {
|
||||
$this->configuration->backupPort = $this->configuration->ldapPort;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ class Connection extends LDAPUtility {
|
|||
private function doCriticalValidation() {
|
||||
$configurationOK = true;
|
||||
$errorStr = 'Configuration Error (prefix '.
|
||||
strval($this->configPrefix).'): ';
|
||||
(string)$this->configPrefix .'): ';
|
||||
|
||||
//options that shall not be empty
|
||||
$options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',
|
||||
|
|
|
@ -285,7 +285,7 @@ class ConfigAPIController extends OCSController {
|
|||
|
||||
$config = new Configuration($configID);
|
||||
$data = $config->getConfiguration();
|
||||
if(!boolval(intval($showPassword))) {
|
||||
if(!(int)$showPassword) {
|
||||
$data['ldapAgentPassword'] = '***';
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
|
|
|
@ -266,7 +266,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
$groups = $this->access->groupsMatchFilter($groups);
|
||||
$allGroups = $groups;
|
||||
$nestedGroups = $this->access->connection->ldapNestedGroups;
|
||||
if (intval($nestedGroups) === 1) {
|
||||
if ((int)$nestedGroups === 1) {
|
||||
foreach ($groups as $group) {
|
||||
$subGroups = $this->_getGroupDNsFromMemberOf($group, $seen);
|
||||
$allGroups = array_merge($allGroups, $subGroups);
|
||||
|
@ -667,8 +667,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
// if possible, read out membership via memberOf. It's far faster than
|
||||
// performing a search, which still is a fallback later.
|
||||
// memberof doesn't support memberuid, so skip it here.
|
||||
if(intval($this->access->connection->hasMemberOfFilterSupport) === 1
|
||||
&& intval($this->access->connection->useMemberOfToDetectMembership) === 1
|
||||
if((int)$this->access->connection->hasMemberOfFilterSupport === 1
|
||||
&& (int)$this->access->connection->useMemberOfToDetectMembership === 1
|
||||
&& strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
|
||||
) {
|
||||
$groupDNs = $this->_getGroupDNsFromMemberOf($userDN);
|
||||
|
|
|
@ -122,7 +122,7 @@ class Helper {
|
|||
|
||||
sort($serverConnections);
|
||||
$lastKey = array_pop($serverConnections);
|
||||
$lastNumber = intval(str_replace('s', '', $lastKey));
|
||||
$lastNumber = (int)str_replace('s', '', $lastKey);
|
||||
return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ class CleanUp extends TimedJob {
|
|||
|
||||
public function __construct() {
|
||||
$minutes = \OC::$server->getConfig()->getSystemValue(
|
||||
'ldapUserCleanupInterval', strval($this->defaultIntervalMin));
|
||||
$this->setInterval(intval($minutes) * 60);
|
||||
'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
|
||||
$this->setInterval((int)$minutes * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,7 +183,7 @@ class CleanUp extends TimedJob {
|
|||
*/
|
||||
private function isCleanUpEnabled() {
|
||||
return (bool)$this->ocConfig->getSystemValue(
|
||||
'ldapUserCleanupInterval', strval($this->defaultIntervalMin));
|
||||
'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,7 +215,7 @@ class CleanUp extends TimedJob {
|
|||
* @return int
|
||||
*/
|
||||
private function getOffset() {
|
||||
return intval($this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0));
|
||||
return (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,7 +90,7 @@ class UUIDFixInsert implements IRepairStep {
|
|||
$offset += $batchSize;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
|
||||
$batchSize = intval(floor(count($records) * 0.8));
|
||||
$batchSize = (int)floor(count($records) * 0.8);
|
||||
$retry = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ class Manager {
|
|||
public function isDeletedUser($id) {
|
||||
$isDeleted = $this->ocConfig->getUserValue(
|
||||
$id, 'user_ldap', 'isDeleted', 0);
|
||||
return intval($isDeleted) === 1;
|
||||
return (int)$isDeleted === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -166,7 +166,7 @@ class OfflineUser {
|
|||
* @return int
|
||||
*/
|
||||
public function getLastLogin() {
|
||||
return intval($this->lastLogin);
|
||||
return (int)$this->lastLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,7 +211,7 @@ class OfflineUser {
|
|||
', 1);
|
||||
$query->execute(array($this->ocName));
|
||||
$sResult = $query->fetchColumn(0);
|
||||
if(intval($sResult) === 1) {
|
||||
if((int)$sResult === 1) {
|
||||
$this->hasActiveShares = true;
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class OfflineUser {
|
|||
', 1);
|
||||
$query->execute(array($this->ocName));
|
||||
$sResult = $query->fetchColumn(0);
|
||||
if(intval($sResult) === 1) {
|
||||
if((int)$sResult === 1) {
|
||||
$this->hasActiveShares = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ class Wizard extends LDAPUtility {
|
|||
if ($attr !== '' && $attr !== 'displayName') {
|
||||
// most likely not the default value with upper case N,
|
||||
// verify it still produces a result
|
||||
$count = intval($this->countUsersWithAttribute($attr, true));
|
||||
$count = (int)$this->countUsersWithAttribute($attr, true);
|
||||
if($count > 0) {
|
||||
//no change, but we sent it back to make sure the user interface
|
||||
//is still correct, even if the ajax call was cancelled meanwhile
|
||||
|
@ -239,7 +239,7 @@ class Wizard extends LDAPUtility {
|
|||
// first attribute that has at least one result wins
|
||||
$displayNameAttrs = array('displayname', 'cn');
|
||||
foreach ($displayNameAttrs as $attr) {
|
||||
$count = intval($this->countUsersWithAttribute($attr, true));
|
||||
$count = (int)$this->countUsersWithAttribute($attr, true);
|
||||
|
||||
if($count > 0) {
|
||||
$this->applyFind('ldap_display_name', $attr);
|
||||
|
@ -267,7 +267,7 @@ class Wizard extends LDAPUtility {
|
|||
|
||||
$attr = $this->configuration->ldapEmailAttribute;
|
||||
if ($attr !== '') {
|
||||
$count = intval($this->countUsersWithAttribute($attr, true));
|
||||
$count = (int)$this->countUsersWithAttribute($attr, true);
|
||||
if($count > 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class CheckApp extends Base {
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
$appid = $input->getArgument('appid');
|
||||
$path = strval($input->getOption('path'));
|
||||
$path = (string)$input->getOption('path');
|
||||
$result = $this->checker->verifyAppSignature($appid, $path);
|
||||
$this->writeArrayInOutputFormat($input, $output, $result);
|
||||
if (count($result)>0){
|
||||
|
|
|
@ -87,14 +87,14 @@ class Manager implements ICommentsManager {
|
|||
* @return array
|
||||
*/
|
||||
protected function normalizeDatabaseData(array $data) {
|
||||
$data['id'] = strval($data['id']);
|
||||
$data['parent_id'] = strval($data['parent_id']);
|
||||
$data['topmost_parent_id'] = strval($data['topmost_parent_id']);
|
||||
$data['id'] = (string)$data['id'];
|
||||
$data['parent_id'] = (string)$data['parent_id'];
|
||||
$data['topmost_parent_id'] = (string)$data['topmost_parent_id'];
|
||||
$data['creation_timestamp'] = new \DateTime($data['creation_timestamp']);
|
||||
if (!is_null($data['latest_child_timestamp'])) {
|
||||
$data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']);
|
||||
}
|
||||
$data['children_count'] = intval($data['children_count']);
|
||||
$data['children_count'] = (int)$data['children_count'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ class Manager implements ICommentsManager {
|
|||
$resultStatement = $query->execute();
|
||||
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
|
||||
$resultStatement->closeCursor();
|
||||
$children = intval($data[0]);
|
||||
$children = (int)$data[0];
|
||||
|
||||
$comment = $this->get($id);
|
||||
$comment->setChildrenCount($children);
|
||||
|
@ -207,7 +207,7 @@ class Manager implements ICommentsManager {
|
|||
if (empty($id)) {
|
||||
return;
|
||||
}
|
||||
$this->commentsCache[strval($id)] = $comment;
|
||||
$this->commentsCache[(string)$id] = $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,7 +216,7 @@ class Manager implements ICommentsManager {
|
|||
* @param mixed $id the comment's id
|
||||
*/
|
||||
protected function uncache($id) {
|
||||
$id = strval($id);
|
||||
$id = (string)$id;
|
||||
if (isset($this->commentsCache[$id])) {
|
||||
unset($this->commentsCache[$id]);
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ class Manager implements ICommentsManager {
|
|||
* @since 9.0.0
|
||||
*/
|
||||
public function get($id) {
|
||||
if (intval($id) === 0) {
|
||||
if ((int)$id === 0) {
|
||||
throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.');
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ class Manager implements ICommentsManager {
|
|||
$resultStatement = $query->execute();
|
||||
$data = $resultStatement->fetch(\PDO::FETCH_NUM);
|
||||
$resultStatement->closeCursor();
|
||||
return intval($data[0]);
|
||||
return (int)$data[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -569,7 +569,7 @@ class Manager implements ICommentsManager {
|
|||
->execute();
|
||||
|
||||
if ($affectedRows > 0) {
|
||||
$comment->setId(strval($qb->getLastInsertId()));
|
||||
$comment->setId((string)$qb->getLastInsertId());
|
||||
$this->sendEvent(CommentsEvent::EVENT_ADD, $comment);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class LargeFileHelper {
|
|||
* PHP platform.
|
||||
*/
|
||||
public function __construct() {
|
||||
$pow_2_53 = floatval(self::POW_2_53_MINUS_1) + 1.0;
|
||||
$pow_2_53 = (float)self::POW_2_53_MINUS_1 + 1.0;
|
||||
if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) {
|
||||
throw new \RuntimeException(
|
||||
'This class assumes floats to be double precision or "better".'
|
||||
|
|
|
@ -52,7 +52,7 @@ class CachingRouter extends Router {
|
|||
*/
|
||||
public function generate($name, $parameters = array(), $absolute = false) {
|
||||
asort($parameters);
|
||||
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . intval($absolute);
|
||||
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute;
|
||||
$cachedKey = $this->cache->get($key);
|
||||
if ($cachedKey) {
|
||||
return $cachedKey;
|
||||
|
|
|
@ -220,8 +220,8 @@ class JSConfigHelper {
|
|||
'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value
|
||||
'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
|
||||
'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
|
||||
'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)),
|
||||
'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)),
|
||||
'sharing.maxAutocompleteResults' => (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0),
|
||||
'sharing.minSearchStringLength' => (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0),
|
||||
'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX,
|
||||
]),
|
||||
"oc_appconfig" => json_encode([
|
||||
|
|
|
@ -148,7 +148,7 @@ class OC_Files {
|
|||
self::lockFiles($view, $dir, $files);
|
||||
|
||||
$streamer->sendHeaders($name);
|
||||
$executionTime = intval(OC::$server->getIniWrapper()->getNumeric('max_execution_time'));
|
||||
$executionTime = (int)OC::$server->getIniWrapper()->getNumeric('max_execution_time');
|
||||
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||
@set_time_limit(0);
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ class OC_Files {
|
|||
*/
|
||||
public static function setUploadLimit($size, $files = []) {
|
||||
//don't allow user to break his config
|
||||
$size = intval($size);
|
||||
$size = (int)$size;
|
||||
if ($size < self::UPLOAD_MIN_LIMIT_BYTES) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ class OC_Helper {
|
|||
public static function computerFileSize($str) {
|
||||
$str = strtolower($str);
|
||||
if (is_numeric($str)) {
|
||||
return floatval($str);
|
||||
return (float)$str;
|
||||
}
|
||||
|
||||
$bytes_array = array(
|
||||
|
@ -158,7 +158,7 @@ class OC_Helper {
|
|||
'p' => 1024 * 1024 * 1024 * 1024 * 1024,
|
||||
);
|
||||
|
||||
$bytes = floatval($str);
|
||||
$bytes = (float)$str;
|
||||
|
||||
if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) {
|
||||
$bytes *= $bytes_array[$matches[1]];
|
||||
|
|
|
@ -284,7 +284,7 @@ function human_file_size( $bytes ) {
|
|||
function strip_time($timestamp){
|
||||
$date = new \DateTime("@{$timestamp}");
|
||||
$date->setTime(0, 0, 0);
|
||||
return intval($date->format('U'));
|
||||
return (int)$date->format('U');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ class SearchResultType {
|
|||
* @since 13.0.0
|
||||
*/
|
||||
protected function getValidatedType($type) {
|
||||
$type = trim(strval($type));
|
||||
$type = trim((string)$type);
|
||||
|
||||
if($type === '') {
|
||||
throw new \InvalidArgumentException('Type must not be empty');
|
||||
|
|
Loading…
Reference in New Issue