<commit_before><?php namespace App\LaravelRestCms;

use App\Library\Sftp;

trait SftpTrait {
    
    /**
     * @var App\Library\Sftp
     */
    protected $sftp;
    
    /**
     * @var string
     */
    protected $sftpConnection;
    
    /**
     * @var string
     */
    protected $remotePath;
    
    /**
     * @var string
     */
    protected $remotePathSuccess;
    
    /**
     * @var string
     */
    protected $remotePathError;
    
    /**
     * @var string
     */
    protected $remotePathProcessed;
    
    /**
     * @var string
     */
    protected $localPath;
    
    /**
     * @var string
     */
    protected $localPathSuccess;
    
    /**
     * @var string
     */
    protected $localPathError;


    /**
     * Gets the path name of a given path
     *
     * @param  string $pathName
     * @return string
     */
   	public function getPath($pathName)
   	{ 	
    	if (!stripos($pathName, 'path') || !property_exists($this, $pathName)) {
    		return false;
    	} else {
    		return $this->{$pathName};
    	}
  	}

    /**
     * Downloads all XML files from a remote folder
     *
     * @param  string $path
     * @return array
     */
   	public function pullFiles($path)
   	{ 	
    	$files = $this->sftp->getFiles($path, $this->localPath);

    	return $files;
  	}

    /**
     * Uploads an XML file to a remote folder
     * 
     * @return array
     */
    public function pushFile($fileName, $fullFileName)
    {   
        $files = $this->sftp->putFile($this->remotePath . '/' . $fileName, $fullFileName);

        return $files;
    }

    /**
     * Moves a file to a folder
     * 
     * @param  string $fullFileName 
     * @param  string $fileName    
     * @param  string $path    
     * @return arrray            
     */
    public function moveTo($fullFileName, $fileName, $path)
    {
        return $this->sftp->rename($fullFileName, $path . '/' . $fileName);
    }

    /**
     * Moves a file to MP's Processed folder
     * 
     * @param  string $fullFileName 
     * @param  string $fileName    
     * @param  string $pathProcessed    
     * @return arrray            
     */
    public function moveToProcessed($fullFileName, $fileName, $pathProcessed = null)
    {
        $pathProcessed = $pathProcessed ?: $this->remotePathProcessed;

        return $this->moveTo($fullFileName, $fileName, $pathProcessed);
    }

    /**
     * Moves a file to MP's Success folder
     * 
     * @param  string $fullFileName 
     * @param  string $fileName    
     * @return arrray            
     */
    public function moveToSuccess($fullFileName, $fileName)
    {
        return $this->moveTo($fullFileName, $fileName, $this->remotePathSuccess);
    }
}<commit_msg>Cleanup<commit_after><?php namespace App\LaravelRestCms;

use App\Library\Sftp;

trait SftpTrait {
    
    /**
     * @var App\Library\Sftp
     */
    protected $sftp;
    
    /**
     * @var string
     */
    protected $sftpConnection;
    
    /**
     * @var string
     */
    protected $remotePath;
    
    /**
     * @var string
     */
    protected $localPath;


    /**
     * Gets the path name of a given path
     *
     * @param  string $pathName
     * @return string
     */
   	public function getPath($pathName)
   	{ 	
    	if (!stripos($pathName, 'path') || !property_exists($this, $pathName)) {
    		return false;
    	} else {
    		return $this->{$pathName};
    	}
  	}

    /**
     * Downloads all XML files from a remote folder
     *
     * @param  string $path
     * @return array
     */
   	public function pullFiles($path)
   	{ 	
    	$files = $this->sftp->getFiles($path, $this->localPath);

    	return $files;
  	}

    /**
     * Uploads an XML file to a remote folder
     * 
     * @return array
     */
    public function pushFile($fileName, $fullFileName)
    {   
        $files = $this->sftp->putFile($this->remotePath . '/' . $fileName, $fullFileName);

        return $files;
    }

    /**
     * Moves a file to a folder
     * 
     * @param  string $fullFileName 
     * @param  string $fileName    
     * @param  string $path    
     * @return arrray            
     */
    public function moveTo($fullFileName, $fileName, $path)
    {
        return $this->sftp->rename($fullFileName, $path . '/' . $fileName);
    }
}
{'fraction_non_alphanumeric': 0.1287633163501621, 'fraction_numerical': 0.0, 'mean_word_length': 1.7615089514066495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6322248', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1375, 'n_words': 306}