Empty lazaret

@param int     $maxTodo

@return Array
198809
public function clear($maxTodo = -1)
    {
        $ret = array(
            'success' => false,
            'message' => '',
            'result'  => array(
                'tobedone'  => 0,
                'done'      => 0,
                'todo'      => 0,
                'max'       => '',
            )
        );

        if( $maxTodo <= 0) {
            $maxTodo = -1;      // all
        }
        $ret['result']['max'] = $maxTodo;

        $ret['result']['tobedone'] = (int) $this->repository->createQueryBuilder('id')
            ->select('COUNT(id)')
            ->getQuery()
            ->getSingleScalarResult();

        if($maxTodo == -1) {
            // all
            $lazaretFiles = $this->repository->findAll();
        } else {
            // limit maxTodo
            $lazaretFiles = $this->repository->findBy(array(), null, $maxTodo);
        }

        $this->entityManager->beginTransaction();

        try {
            foreach ($lazaretFiles as $lazaretFile) {
                $this->denyLazaretFile($lazaretFile);
                $ret['result']['done']++;
            }
            $this->entityManager->commit();
            $ret['success'] = true;
        } catch (\Exception $e) {
            $this->entityManager->rollback();
            $ret['message'] = $this->app->trans('An error occured');
        }
        $ret['result']['todo'] = $ret['result']['tobedone'] - $ret['result']['done'];

        return $ret;
    }
258244
public function deleteFailedLoginAttempts($maxAge = null)
    {
        $sql = 'DELETE FROM FailedLoginAttempts';
        if ($maxAge) {
            $platform = $this->connection->getDatabasePlatform();
            $sql .= ' WHERE flaTimestamp <= ' . $platform->getDateSubSecondsExpression($platform->getNowExpression(), (int) $maxAge);
        }

        return (int) $this->connection->executeQuery($sql)->rowCount();
    }
1347292
protected function getNodesBetween($min, $max)
    {
        $config = $this->config;
        $query = $this->tree->table()
                ->select(NULL)// fetch only id
                ->select("$config[id] AS id")
                ->where("($config[lft] >= :min AND $config[lft] <= :max) OR ($config[rgt] >= :min AND $config[rgt] <= :max)", [
                    ':min' => $min,
                    ':max' => $max,
                ])
                ->fetchAll();
        $ids = array_map(function ($key) {
            return $key['id'];
        }, $query);
        return $ids;
    }
1206712
public function getFullName($fullData = null) {
		$result = $this->getEmptyText();
		if (empty($fullData)) {
			return $result;
		}

		$fieldsFullName = [
			[
				CAKE_LDAP_LDAP_ATTRIBUTE_SURNAME,
				CAKE_LDAP_LDAP_ATTRIBUTE_GIVEN_NAME,
				CAKE_LDAP_LDAP_ATTRIBUTE_MIDDLE_NAME
			],
			[
				CAKE_LDAP_LDAP_ATTRIBUTE_DISPLAY_NAME,
				CAKE_LDAP_LDAP_ATTRIBUTE_NAME
			]
		];
		$dataFullName = [];
		foreach ($fieldsFullName[0] as $field) {
			$dataItem = h(Hash::get($fullData, $field));
			if (!empty($dataItem)) {
				$dataFullName[] = mb_ucfirst($dataItem);
			}
		}
		if (count($dataFullName) == 3) {
			$result = implode(' ', $dataFullName);

			return $result;
		}

		foreach ($fieldsFullName[1] as $field) {
			$dataItem = h(Hash::get($fullData, $field));
			if (empty($dataItem)) {
				continue;
			}

			$result = mb_ucfirst($dataItem);
		}

		return $result;
	}
541208
protected function getMax()
    {
        $params = array_filter(func_get_args() ?: [], function ($arg) {
            return !is_null($arg) && $arg !== "";
        });

        return count($params) > 0 ? max($params) : null;
    }
346225
public function getEstimatedNbColumns($maxTotalWidth)
    {
        $i = 0;
        $rowWidth = 0;

        while (isset($this->cells[$i])) {
            $rowWidth += StringUtil::getLength($this->cells[$i]);

            if ($rowWidth > $maxTotalWidth) {
                // Return previous number of columns
                return $i;
            }

            ++$i;
        }

        return $i;
    }
257801
public function max(Date $dt = null)
    {
        $dt = $dt ?: static::now($this->getTimezone());

        return $this->isAfter($dt) ? clone $this : clone $dt;
    }
429929
public function max($max=null)
    {
        $max = LambdaUtils::toSelectCallable($max);
        $temp = $this->select($max)->toArray();
        return max($temp);
    }
1276287
public function toDTO($filterByKey = null)
    {
        if (! $this->getAttribute("recipient") || ! $this->getAttribute("mosaicId"))
            return [];

        return [
            "type" => $this->type,
            "recipient" => $this->recipient()->address()->toClean(),
            "mosaicId" => $this->mosaicId()->toDTO(),
            "fee" => $this->fee,
        ];
    }
1241818
protected function getFilesRecursively( $directory, $zipMaxSize )
  {
    $allFiles = array();
    $_zipFilesSize = 0;
    $serverPath = str_replace('\\','/',$directory);

    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::CHILD_FIRST) as $file ) {
      if ( !$this->checkOneFile($file) ){
        continue;
      }
      if ( !empty($zipMaxSize) ){
        clearstatcache();
        $_zipFilesSize += $file->getSize();
        if ( $_zipFilesSize > $zipMaxSize ) {
          $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG);
        }
      }
      $pathName = str_replace('\\','/',$file->getPathname());
      if ( $file->isDir() ){
        // skip dot folders on unix systems ( do not try to use isDot() as $file is not a  DirectoryIterator obj )
        if ( in_array($file->getFilename(),array('..','.')) ){
          continue;
        }
        if ($pathName != rtrim($serverPath,'/')){
          $allFiles[ ltrim(str_ireplace(rtrim($serverPath,'/'),'',$pathName),'/') ] = '';
        }
      } else {
        $allFiles[$pathName] = str_ireplace($serverPath,'',$pathName);
      }
    }

    return $allFiles;
  }
202222
public function getColumnSizeOptions($max = null)
    {
        return ArrayLib::valuekey(range(1, $max ? $max : $this->getNumberOfColumns()));
    }
505103
public function countArray($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(!is_array($this->value)||count($this->value) < $min || count($this->value) > $max, false);
    }
809289
public function all()
    {
        foreach ($this->getAll() as $widget) {
            foreach ($widget as $name => $args) {
                $widgets[] = $this->widget($name, $args);
            }
        }

        return empty($widgets) ? null : trim(implode(PHP_EOL, $widgets));
    }
739204
public function getByCode($sCode)
    {
        $aCountries = $this->getAll();

        return ! empty($aCountries[$sCode]) ? $aCountries[$sCode] : false;
    }
997521
public function getData($table, $max, $exclude = null, $orderBy = null, $direction = 'ASC')
    {
        $result = \DB::connection($this->databaseName)->table($table);

        if (!empty($exclude)) {
            $allColumns = \DB::connection($this->databaseName)->getSchemaBuilder()->getColumnListing($table);
            $result = $result->select(array_diff($allColumns, $exclude));
        }

        if($orderBy) {
            $result = $result->orderBy($orderBy, $direction);
        }

        if ($max) {
            $result = $result->limit($max);
        }

        return $result->get();
    }
811779
public function getRepliesTo(DataObject $to, $sortBy = 'ID', $since = 0, $before = false, $topLevelOnly = false, $tags = array(), $offset = 0, $number = 100) {
		$filter = array(
			'ParentID'			=> $to->ID, 
		);
		return $this->microPostList($filter, $sortBy, $since, $before, $topLevelOnly, $tags, $offset, $number);
	}
112385
public function take(int $max = null)
    {
        $items = $this->get('items');

        if (!isset($max)) {
            $max = $items->count();
        }
        if ($items->count() >= $max) {
            $items = $items->take($max);
        }

        $this->content['items'] = $items;

        return $this;
    }