<commit_before><?php
namespace Devture\Bundle\UserBundle\Twig;

use Devture\Bundle\UserBundle\AccessControl\AccessControl;

class UserExtension extends \Twig_Extension {

	private $control;

	public function __construct(AccessControl $control) {
		$this->control = $control;
	}

	public function getName() {
		return 'devture_user_user_extension';
	}

	public function getFunctions() {
		return array(
			'get_user' => new \Twig_Function_Method($this, 'getUser'),
			'is_logged_in' => new \Twig_Function_Method($this, 'isLoggedIn'),
			'is_granted' => new \Twig_Function_Method($this, 'isGranted'),
		);
	}

	/**
	 * @return \Devture\Bundle\UserBundle\Model\User|NULL
	 */
	public function getUser() {
		return $this->control->getUser();
	}

	/**
	 * @return boolean
	 */
	public function isLoggedIn() {
		return $this->control->isLoggedIn();
	}

	/**
	 * @param string $role
	 * @return boolean
	 */
	public function isGranted($role) {
		return $this->control->isGranted($role);
	}

}

<commit_msg>Fix deprecated Twig class usage<commit_after><?php
namespace Devture\Bundle\UserBundle\Twig;

use Devture\Bundle\UserBundle\AccessControl\AccessControl;

class UserExtension extends \Twig_Extension {

	private $control;

	public function __construct(AccessControl $control) {
		$this->control = $control;
	}

	public function getName() {
		return 'devture_user_user_extension';
	}

	public function getFunctions() {
		return array(
			new \Twig_SimpleFunction('get_user', array($this, 'getUser')),
			new \Twig_SimpleFunction('is_logged_in', array($this, 'isLoggedIn')),
			new \Twig_SimpleFunction('is_granted', array($this, 'isGranted')),
		);
	}

	/**
	 * @return \Devture\Bundle\UserBundle\Model\User|NULL
	 */
	public function getUser() {
		return $this->control->getUser();
	}

	/**
	 * @return boolean
	 */
	public function isLoggedIn() {
		return $this->control->isLoggedIn();
	}

	/**
	 * @param string $role
	 * @return boolean
	 */
	public function isGranted($role) {
		return $this->control->isGranted($role);
	}

}


{'fraction_non_alphanumeric': 0.14743589743589744, 'fraction_numerical': 0.0, 'mean_word_length': 4.454301075268817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '7386615', 'n_tokens_mistral': 741, 'n_tokens_neox': 680, 'n_words': 130}