original_string: protected function checkRequires($modulePath)
      {
          $requires = $this->getConfig('requires', array());
  
          foreach($requires as $key => $value)
          {
              if (is_array($value))
              {
                  if (!$this->files->exists($modulePath.'/'.$key))
                  {
                      $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                      return false;
                  }
                  $jsonFile = json_decode($this->app['files']->get($modulePath.'/'.$key), true);
                  foreach($value as $key)
                  {
                      if (is_array($jsonFile))
                      {
                          if (!array_key_exists($key, $jsonFile) || empty($jsonFile[$key]))
                          {
                              $this->errors->add('module_requires', 'This module has not requires files');
                              return false;
                          }
                      }
                      else
                      {
                          $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                          return false;
                      }
                  }
              }
              else
              {
                  if (!$this->files->exists($modulePath.'/'.$value))
                  {
                      $this->errors->add('module_requires', 'This module has not requires files');
                      return false;
                  }
              }
          }
          return true;
      }
code: protected function checkRequires($modulePath)
      {
          $requires = $this->getConfig('requires', array());
  
          foreach($requires as $key => $value)
          {
              if (is_array($value))
              {
                  if (!$this->files->exists($modulePath.'/'.$key))
                  {
                      $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                      return false;
                  }
                  $jsonFile = json_decode($this->app['files']->get($modulePath.'/'.$key), true);
                  foreach($value as $key)
                  {
                      if (is_array($jsonFile))
                      {
                          if (!array_key_exists($key, $jsonFile) || empty($jsonFile[$key]))
                          {
                              $this->errors->add('module_requires', 'This module has not requires files');
                              return false;
                          }
                      }
                      else
                      {
                          $this->errors->add($this->configFile, $this->configFile.' is corrupted.');
                          return false;
                      }
                  }
              }
              else
              {
                  if (!$this->files->exists($modulePath.'/'.$value))
                  {
                      $this->errors->add('module_requires', 'This module has not requires files');
                      return false;
                  }
              }
          }
          return true;
      }
code_tokens: protected function checkRequires ( $ modulePath ) { $ requires = $ this -> getConfig ( 'requires' , array ( ) ) ; foreach ( $ requires as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( ! $ this -> files -> exists ( $ modulePath . '/' . $ key ) ) { $ this -> errors -> add ( $ this -> configFile , $ this -> configFile . ' is corrupted.' ) ; return false ; } $ jsonFile = json_decode ( $ this -> app [ 'files' ] -> get ( $ modulePath . '/' . $ key ) , true ) ; foreach ( $ value as $ key ) { if ( is_array ( $ jsonFile ) ) { if ( ! array_key_exists ( $ key , $ jsonFile ) || empty ( $ jsonFile [ $ key ] ) ) { $ this -> errors -> add ( 'module_requires' , 'This module has not requires files' ) ; return false ; } } else { $ this -> errors -> add ( $ this -> configFile , $ this -> configFile . ' is corrupted.' ) ; return false ; } } } else { if ( ! $ this -> files -> exists ( $ modulePath . '/' . $ value ) ) { $ this -> errors -> add ( 'module_requires' , 'This module has not requires files' ) ; return false ; } } } return true ; }
docstring: Check module has required file
  
  @param string $modulePath
  @return bool
docstring_tokens: Check module has required file