<commit_before><?php
/**
 * Created by PhpStorm.
 * User: jeremy.dubois
 * Date: 27/09/2014
 * Time: 16:12
 */

namespace Core\Service;


use Core\Service\Api\Request;
use Core\Annotations\Paginate;
use Core\Annotations\Doc;
use Core\Annotations\Table;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Zend\View\Model\JsonModel;
use Zend\View\Model\ViewModel;
use Zend\View\Variables;
use Zend\View\Model\ConsoleModel;
use Core\Exception\ApiException;
use Core\Jobs\Api as JobAPI;
/**
 * Class API
 * @package Core\Service
 */
class APIL extends \Core\Service\CoreService implements ServiceLocatorAwareInterface
{
    protected $path;
    protected $id_user;
    protected $params;
    public function __construct()
    {
    }

    public function path($path)
    {
        $this->path = $path;
        return $this;
    }
    public function params($params)
    {
        $this->params = $params;
        return $this;
    }
    public function param($name, $value)
    {
        if(!isset($this->params))
        {
            $this->params = [];
        }
        $this->params[$name] = $value;
        return $this;
    }
    public function user($user)
    {
        if(is_numeric($user))
        {
            $user = $this->sm->get("UserTable")->getUser($user);
        }
        $this->id_user = $user->id;
        return $this;
    }
    public function send()
    {
        $job = $this->sm->get('QueueService')->createLJob(JobAPI::class, ["path"=>$this->path,"api_user"=>$this->id_user,"params"=>$this->params]);
        $job->send();
        $this->id_user = NULL;
        $this->path = NULL;
        $this->params = NULL;
    }
    public function sendNow()
    {<commit_msg>if user null => ignore<commit_after><?php
/**
 * Created by PhpStorm.
 * User: jeremy.dubois
 * Date: 27/09/2014
 * Time: 16:12
 */

namespace Core\Service;


use Core\Service\Api\Request;
use Core\Annotations\Paginate;
use Core\Annotations\Doc;
use Core\Annotations\Table;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Zend\View\Model\JsonModel;
use Zend\View\Model\ViewModel;
use Zend\View\Variables;
use Zend\View\Model\ConsoleModel;
use Core\Exception\ApiException;
use Core\Jobs\Api as JobAPI;
/**
 * Class API
 * @package Core\Service
 */
class APIL extends \Core\Service\CoreService implements ServiceLocatorAwareInterface
{
    protected $path;
    protected $id_user;
    protected $params;
    public function __construct()
    {
    }

    public function path($path)
    {
        $this->path = $path;
        return $this;
    }
    public function params($params)
    {
        $this->params = $params;
        return $this;
    }
    public function param($name, $value)
    {
        if(!isset($this->params))
        {
            $this->params = [];
        }
        $this->params[$name] = $value;
        return $this;
    }
    public function user($user)
    {
        if(!isset($user))
        {
            return $this;
        }
        if(is_numeric($user))
        {
            $user = $this->sm->get("UserTable")->getUser($user);
        }
        $this->id_user = $user->id;
        return $this;
    }
    public function send()
    {
        $job = $this->sm->get('QueueService')->createLJob(JobAPI::class, ["path"=>$this->path,"api_user"=>$this->id_user,"params"=>$this->params]);
        $job->send();
        $this->id_user = NULL;
        $this->path = NULL;
        $this->params = NULL;
    }
    public function sendNow()
    {
{'fraction_non_alphanumeric': 0.1466992665036675, 'fraction_numerical': 0.006519967400162999, 'mean_word_length': 2.574757281553398, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6774291', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1162, 'n_words': 224}