<commit_before><?php
namespace Tuum\Web;

use Tuum\Locator\Container;
use Tuum\Locator\Locator;
use Tuum\Web\Http\Request;
use Tuum\Web\Http\Response;
use Tuum\Web\ServiceInterface\ContainerInterface;
use Tuum\Web\ServiceInterface\RendererInterface;
use Tuum\Web\Stack\Stackable;
use Tuum\Web\Stack\StackableInterface;
use Tuum\Web\Stack\StackHandleInterface;

/**
 * Class App
 *
 * @package Tuum\Web
 *          web application.
 *
 *
 *          
 */
class App implements ContainerInterface
{
    const VIEW_DATA = 'data';
    const TOKEN_NAME = 'token';
    const FLASH_NAME = 'flash';
    const ROUTE_PARAM = 'params';
    const ROUTE_NAMES = 'namedRoutes';
    const CONTROLLER  = 'controller';
    const RENDER_ENGINE = 'renderer';
    
    /**
     * @var ContainerInterface
     */
    public $container;

    /**
     * @var StackableInterface
     */
    public $stack;

    /**
     * @param ContainerInterface $container
     */
    public function __construct($container)
    {
        $this->container = $container;
    }

    /**
     * @param ContainerInterface $container
     * @return static
     */
    public static function forge($container=null)
    {
        $container = $container ?: new Container(new Locator());
        return new static($container);
    }

    /**
     * @param string $key
     * @param array  $data
     * @return mixed
     */
    public function __call($key, $data=[])
    {
        return $this->get($key, $data);
    }

    /**
     * @param string $key
     * @param array  $data
     * @return mixed
     */
    public function get($key, $data = [])
    {
        return $this->container->get($key, $data);
    }

    /**
     * @param string $key
     * @param mixed  $value
     * @return $this<commit_msg>App's get method sets itself as app when getting an object from the container.<commit_after><?php
namespace Tuum\Web;

use Tuum\Locator\Container;
use Tuum\Locator\Locator;
use Tuum\Web\Http\Request;
use Tuum\Web\Http\Response;
use Tuum\Web\ServiceInterface\ContainerInterface;
use Tuum\Web\ServiceInterface\RendererInterface;
use Tuum\Web\Stack\Stackable;
use Tuum\Web\Stack\StackableInterface;
use Tuum\Web\Stack\StackHandleInterface;

/**
 * Class App
 *
 * @package Tuum\Web
 *          web application.
 *
 *
 *          
 */
class App implements ContainerInterface
{
    const VIEW_DATA = 'data';
    const TOKEN_NAME = 'token';
    const FLASH_NAME = 'flash';
    const ROUTE_PARAM = 'params';
    const ROUTE_NAMES = 'namedRoutes';
    const CONTROLLER  = 'controller';
    const RENDER_ENGINE = 'renderer';
    
    /**
     * @var ContainerInterface
     */
    public $container;

    /**
     * @var StackableInterface
     */
    public $stack;

    /**
     * @param ContainerInterface $container
     */
    public function __construct($container)
    {
        $this->container = $container;
    }

    /**
     * @param ContainerInterface $container
     * @return static
     */
    public static function forge($container=null)
    {
        $container = $container ?: new Container(new Locator());
        return new static($container);
    }

    /**
     * @param string $key
     * @param array  $data
     * @return mixed
     */
    public function __call($key, $data=[])
    {
        return $this->get($key, $data);
    }

    /**
     * @param string $key
     * @param array  $data
     * @return mixed
     */
    public function get($key, $data = [])
    {
        $data['app'] = $this;
        return $this->container->get($key, $data);
    }

    /**
     * @param string $key
     * @param mixed  $value
     * @return $this
{'fraction_non_alphanumeric': 0.12979839823253245, 'fraction_numerical': 0.0, 'mean_word_length': 2.385046728971963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5642396', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1117, 'n_words': 260}