/**
  * Return an array without all instances of certain values
  */
 public static function without()
 {
     $arguments = func_get_args();
     $array = array_shift($arguments);
     // if singular argument and is an array treat this AS the array to run without agains
     if (is_array($arguments[0]) && count($arguments) === 1) {
         $arguments = $arguments[0];
     }
     return ArraysMethods::filter($array, function ($value) use($arguments) {
         return !in_array($value, $arguments);
     });
 }
 /**
  * Return an array without all instances of certain values
  */
 public static function without()
 {
     $arguments = func_get_args();
     $array = array_shift($arguments);
     return ArraysMethods::filter($array, function ($value) use($arguments) {
         return !in_array($value, $arguments);
     });
 }
Exemple #3
0
 /**
  * Clean old save folders
  *
  * @return Manager
  */
 public function cleanup()
 {
     // Fetch all dumps folders
     $folders = $this->getAllFolders();
     $folders = Arrays::filter($folders, function ($folder) {
         return is_dir($folder);
     });
     // Parse the date for each one
     foreach ($folders as $folder) {
         // Get date from folder name
         $date = $this->getDateFromFolder($folder);
         // If dump from last year, remove
         if ($date->format('Y') < date('Y')) {
             $this->app['files']->deleteDirectory($folder);
             continue;
         }
         // If dump from last months, just keep main checkpoints
         if ($date->format('m') < date('m') and !in_array($date->format('d'), array(1, 15))) {
             $this->app['files']->deleteDirectory($folder);
             continue;
         }
     }
     return $this;
 }