original_string: public function checkModuleDepends($moduleName, Version $curVersion, Version $newVersion = null)
      {
          $modules = $this->getListAllModules();
          $clean = true;
          $i = 0;
  
          foreach ($modules as $module)
          {
              $depends = $this->def($module['name'], 'require', false, array());
              if (!is_array($depends))
              {
                  $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                  return false;
              }
  
              if (array_key_exists($moduleName, $depends))
              {
                  if (!is_null($newVersion)) //Check for update a module
                  {
                      $dependVersion = new Version($depends[$moduleName]);
                      if (!$newVersion->isPartOf($dependVersion))
                      {
                          $clean = false;
                          $this->errors->add("module_depend_$i", "Can not update $moduleName, ".$module['name'].' Depend to version '.$dependVersion->getOriginalVersion().' of '.$moduleName);
                      }
                  }
                  else //Check for delete a module
                  {
                      $clean = false;
                      $this->errors->add("module_depend_$i", "Can not uninstall $moduleName, ".$module['name'].' Depend this module.');
                  }
              }
              $i++;
          }
  
          if (!$clean)
              return true;
          return false;
      }
code: public function checkModuleDepends($moduleName, Version $curVersion, Version $newVersion = null)
      {
          $modules = $this->getListAllModules();
          $clean = true;
          $i = 0;
  
          foreach ($modules as $module)
          {
              $depends = $this->def($module['name'], 'require', false, array());
              if (!is_array($depends))
              {
                  $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                  return false;
              }
  
              if (array_key_exists($moduleName, $depends))
              {
                  if (!is_null($newVersion)) //Check for update a module
                  {
                      $dependVersion = new Version($depends[$moduleName]);
                      if (!$newVersion->isPartOf($dependVersion))
                      {
                          $clean = false;
                          $this->errors->add("module_depend_$i", "Can not update $moduleName, ".$module['name'].' Depend to version '.$dependVersion->getOriginalVersion().' of '.$moduleName);
                      }
                  }
                  else //Check for delete a module
                  {
                      $clean = false;
                      $this->errors->add("module_depend_$i", "Can not uninstall $moduleName, ".$module['name'].' Depend this module.');
                  }
              }
              $i++;
          }
  
          if (!$clean)
              return true;
          return false;
      }
code_tokens: public function checkModuleDepends ( $ moduleName , Version $ curVersion , Version $ newVersion = null ) { $ modules = $ this -> getListAllModules ( ) ; $ clean = true ; $ i = 0 ; foreach ( $ modules as $ module ) { $ depends = $ this -> def ( $ module [ 'name' ] , 'require' , false , array ( ) ) ; if ( ! is_array ( $ depends ) ) { $ this -> errors -> add ( $ this -> configFile , $ this -> configFile . ' is corrupted.' ) ; return false ; } if ( array_key_exists ( $ moduleName , $ depends ) ) { if ( ! is_null ( $ newVersion ) ) //Check for update a module { $ dependVersion = new Version ( $ depends [ $ moduleName ] ) ; if ( ! $ newVersion -> isPartOf ( $ dependVersion ) ) { $ clean = false ; $ this -> errors -> add ( "module_depend_$i" , "Can not update $moduleName, " . $ module [ 'name' ] . ' Depend to version ' . $ dependVersion -> getOriginalVersion ( ) . ' of ' . $ moduleName ) ; } } else //Check for delete a module { $ clean = false ; $ this -> errors -> add ( "module_depend_$i" , "Can not uninstall $moduleName, " . $ module [ 'name' ] . ' Depend this module.' ) ; } } $ i ++ ; } if ( ! $ clean ) return true ; return false ; }
docstring: Check others modules depends to this module or not, when update or delete module
  
  @param string $moduleName
  @param Chee\Version\Version $curVersion for update required
  @param Chee\Version\Version $newVersion for delete not required
  @return bool
docstring_tokens: Check others modules depends to this module or not when update or delete module