original_string: public function validate($path, $filename = null)
      {
          $pathinfo = isset($filename) ? pathinfo($filename) : pathinfo($path);
  
          if (empty($pathinfo['filename'])) {
              return $this->translation->text('Unknown filename');
          }
  
          if (empty($pathinfo['extension'])) {
              return $this->translation->text('Unknown file extension');
          }
  
          if ($this->handler === false) {
              return true;
          }
  
          if (!isset($this->handler)) {
              try {
                  $this->setHandlerByExtension($pathinfo['extension']);
              } catch (Exception $ex) {
                  return $ex->getMessage();
              }
          }
  
          if (!isset($this->destination) && isset($this->handler['path'])) {
              $this->destination = $this->handler['path'];
          }
  
          try {
              return $this->validateHandler($path, $pathinfo['extension']);
          } catch (Exception $ex) {
              return $ex->getMessage();
          }
      }
code: public function validate($path, $filename = null)
      {
          $pathinfo = isset($filename) ? pathinfo($filename) : pathinfo($path);
  
          if (empty($pathinfo['filename'])) {
              return $this->translation->text('Unknown filename');
          }
  
          if (empty($pathinfo['extension'])) {
              return $this->translation->text('Unknown file extension');
          }
  
          if ($this->handler === false) {
              return true;
          }
  
          if (!isset($this->handler)) {
              try {
                  $this->setHandlerByExtension($pathinfo['extension']);
              } catch (Exception $ex) {
                  return $ex->getMessage();
              }
          }
  
          if (!isset($this->destination) && isset($this->handler['path'])) {
              $this->destination = $this->handler['path'];
          }
  
          try {
              return $this->validateHandler($path, $pathinfo['extension']);
          } catch (Exception $ex) {
              return $ex->getMessage();
          }
      }
code_tokens: public function validate ( $ path , $ filename = null ) { $ pathinfo = isset ( $ filename ) ? pathinfo ( $ filename ) : pathinfo ( $ path ) ; if ( empty ( $ pathinfo [ 'filename' ] ) ) { return $ this -> translation -> text ( 'Unknown filename' ) ; } if ( empty ( $ pathinfo [ 'extension' ] ) ) { return $ this -> translation -> text ( 'Unknown file extension' ) ; } if ( $ this -> handler === false ) { return true ; } if ( ! isset ( $ this -> handler ) ) { try { $ this -> setHandlerByExtension ( $ pathinfo [ 'extension' ] ) ; } catch ( Exception $ ex ) { return $ ex -> getMessage ( ) ; } } if ( ! isset ( $ this -> destination ) && isset ( $ this -> handler [ 'path' ] ) ) { $ this -> destination = $ this -> handler [ 'path' ] ; } try { return $ this -> validateHandler ( $ path , $ pathinfo [ 'extension' ] ) ; } catch ( Exception $ ex ) { return $ ex -> getMessage ( ) ; } }
docstring: Validate a file
  @param string $path
  @param null|string $filename
  @return boolean|string
docstring_tokens: Validate a file