original_string: protected function _scandir($path) {
  		
  		$s3path = preg_replace("/^\//", "", $path) . '/';
  		
  		$files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents;
  	
  		$finalfiles = array();
  		
  		foreach ($files as $file) {
  			if (preg_match("|^" . $s3path . "[^/]*/?$|", $file->Key)) {
  				$fname = preg_replace("/\/$/", "", $file->Key);
  				$fname = $file->Key;
  				
  				if ($fname != preg_replace("/\/$/", "", $s3path)) {
  					
  				}
  				
  				$finalfiles[] = $fname;
  			}
  		}
  		
  		sort($finalfiles);
  		return $finalfiles;
  	}
code: protected function _scandir($path) {
  		
  		$s3path = preg_replace("/^\//", "", $path) . '/';
  		
  		$files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents;
  	
  		$finalfiles = array();
  		
  		foreach ($files as $file) {
  			if (preg_match("|^" . $s3path . "[^/]*/?$|", $file->Key)) {
  				$fname = preg_replace("/\/$/", "", $file->Key);
  				$fname = $file->Key;
  				
  				if ($fname != preg_replace("/\/$/", "", $s3path)) {
  					
  				}
  				
  				$finalfiles[] = $fname;
  			}
  		}
  		
  		sort($finalfiles);
  		return $finalfiles;
  	}
code_tokens: protected function _scandir ( $ path ) { $ s3path = preg_replace ( "/^\//" , "" , $ path ) . '/' ; $ files = $ this -> s3 -> ListBucket ( array ( 'Bucket' => $ this -> options [ 'bucket' ] , 'delimiter' => '/' , 'Prefix' => $ s3path ) ) -> ListBucketResponse -> Contents ; $ finalfiles = array ( ) ; foreach ( $ files as $ file ) { if ( preg_match ( "|^" . $ s3path . "[^/]*/?$|" , $ file -> Key ) ) { $ fname = preg_replace ( "/\/$/" , "" , $ file -> Key ) ; $ fname = $ file -> Key ; if ( $ fname != preg_replace ( "/\/$/" , "" , $ s3path ) ) { } $ finalfiles [ ] = $ fname ; } } sort ( $ finalfiles ) ; return $ finalfiles ; }
docstring: Return files list in directory
  
  @param  string  $path  dir path
  @return array
  @author Dmitry (dio) Levashov,
  @author Alexey Sukhotin
docstring_tokens: Return files list in directory