File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Definition.php.tar
httpdocs/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/Definition.php 0000644 00000003476 15154643143 0034171 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
/**
* An extension to the Definition class to prevent constructor injection from being possible.
*/
namespace Automattic\WooCommerce\Internal\DependencyManagement;
use Automattic\WooCommerce\Vendor\League\Container\Definition\Definition as BaseDefinition;
/**
* An extension of the definition class that replaces constructor injection with method injection.
*/
class Definition extends BaseDefinition {
/**
* The standard method that we use for dependency injection.
*/
public const INJECTION_METHOD = 'init';
/**
* Resolve a class using method injection instead of constructor injection.
*
* @param string $concrete The concrete to instantiate.
*
* @return object
*/
protected function resolveClass( string $concrete ) {
$instance = new $concrete();
$this->invokeInit( $instance );
return $instance;
}
/**
* Invoke methods on resolved instance, including 'init'.
*
* @param object $instance The concrete to invoke methods on.
*
* @return object
*/
protected function invokeMethods( $instance ) {
$this->invokeInit( $instance );
parent::invokeMethods( $instance );
return $instance;
}
/**
* Invoke the 'init' method on a resolved object.
*
* Constructor injection causes backwards compatibility problems
* so we will rely on method injection via an internal method.
*
* @param object $instance The resolved object.
* @return void
*/
private function invokeInit( $instance ) {
$resolved = $this->resolveArguments( $this->arguments );
if ( method_exists( $instance, static::INJECTION_METHOD ) ) {
call_user_func_array( array( $instance, static::INJECTION_METHOD ), $resolved );
}
}
/**
* Forget the cached resolved object, so the next time it's requested
* it will be resolved again.
*/
public function forgetResolved() {
$this->resolved = null;
}
}
httpdocs/wp-content/plugins/woocommerce/lib/packages/League/Container/Definition/Definition.php 0000644 00000013032 15155174474 0035307 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php declare(strict_types=1);
namespace Automattic\WooCommerce\Vendor\League\Container\Definition;
use Automattic\WooCommerce\Vendor\League\Container\Argument\{
ArgumentResolverInterface, ArgumentResolverTrait, ClassNameInterface, RawArgumentInterface
};
use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
use ReflectionClass;
use ReflectionException;
class Definition implements ArgumentResolverInterface, DefinitionInterface
{
use ArgumentResolverTrait;
use ContainerAwareTrait;
/**
* @var string
*/
protected $alias;
/**
* @var mixed
*/
protected $concrete;
/**
* @var boolean
*/
protected $shared = false;
/**
* @var array
*/
protected $tags = [];
/**
* @var array
*/
protected $arguments = [];
/**
* @var array
*/
protected $methods = [];
/**
* @var mixed
*/
protected $resolved;
/**
* Constructor.
*
* @param string $id
* @param mixed $concrete
*/
public function __construct(string $id, $concrete = null)
{
$concrete = $concrete ?? $id;
$this->alias = $id;
$this->concrete = $concrete;
}
/**
* {@inheritdoc}
*/
public function addTag(string $tag) : DefinitionInterface
{
$this->tags[$tag] = true;
return $this;
}
/**
* {@inheritdoc}
*/
public function hasTag(string $tag) : bool
{
return isset($this->tags[$tag]);
}
/**
* {@inheritdoc}
*/
public function setAlias(string $id) : DefinitionInterface
{
$this->alias = $id;
return $this;
}
/**
* {@inheritdoc}
*/
public function getAlias() : string
{
return $this->alias;
}
/**
* {@inheritdoc}
*/
public function setShared(bool $shared = true) : DefinitionInterface
{
$this->shared = $shared;
return $this;
}
/**
* {@inheritdoc}
*/
public function isShared() : bool
{
return $this->shared;
}
/**
* {@inheritdoc}
*/
public function getConcrete()
{
return $this->concrete;
}
/**
* {@inheritdoc}
*/
public function setConcrete($concrete) : DefinitionInterface
{
$this->concrete = $concrete;
$this->resolved = null;
return $this;
}
/**
* {@inheritdoc}
*/
public function addArgument($arg) : DefinitionInterface
{
$this->arguments[] = $arg;
return $this;
}
/**
* {@inheritdoc}
*/
public function addArguments(array $args) : DefinitionInterface
{
foreach ($args as $arg) {
$this->addArgument($arg);
}
return $this;
}
/**
* {@inheritdoc}
*/
public function addMethodCall(string $method, array $args = []) : DefinitionInterface
{
$this->methods[] = [
'method' => $method,
'arguments' => $args
];
return $this;
}
/**
* {@inheritdoc}
*/
public function addMethodCalls(array $methods = []) : DefinitionInterface
{
foreach ($methods as $method => $args) {
$this->addMethodCall($method, $args);
}
return $this;
}
/**
* {@inheritdoc}
*/
public function resolve(bool $new = false)
{
$concrete = $this->concrete;
if ($this->isShared() && $this->resolved !== null && $new === false) {
return $this->resolved;
}
if (is_callable($concrete)) {
$concrete = $this->resolveCallable($concrete);
}
if ($concrete instanceof RawArgumentInterface) {
$this->resolved = $concrete->getValue();
return $concrete->getValue();
}
if ($concrete instanceof ClassNameInterface) {
$concrete = $concrete->getClassName();
}
if (is_string($concrete) && class_exists($concrete)) {
$concrete = $this->resolveClass($concrete);
}
if (is_object($concrete)) {
$concrete = $this->invokeMethods($concrete);
}
if (is_string($concrete) && $this->getContainer()->has($concrete)) {
$concrete = $this->getContainer()->get($concrete);
}
$this->resolved = $concrete;
return $concrete;
}
/**
* Resolve a callable.
*
* @param callable $concrete
*
* @return mixed
*/
protected function resolveCallable(callable $concrete)
{
$resolved = $this->resolveArguments($this->arguments);
return call_user_func_array($concrete, $resolved);
}
/**
* Resolve a class.
*
* @param string $concrete
*
* @return object
*
* @throws ReflectionException
*/
protected function resolveClass(string $concrete)
{
$resolved = $this->resolveArguments($this->arguments);
$reflection = new ReflectionClass($concrete);
return $reflection->newInstanceArgs($resolved);
}
/**
* Invoke methods on resolved instance.
*
* @param object $instance
*
* @return object
*/
protected function invokeMethods($instance)
{
foreach ($this->methods as $method) {
$args = $this->resolveArguments($method['arguments']);
/** @var callable $callable */
$callable = [$instance, $method['method']];
call_user_func_array($callable, $args);
}
return $instance;
}
}
httpdocs/wp-content/plugins/so-widgets-bundle/base/inc/lib/Less/Tree/Mixin/Definition.php 0000644 00000014253 15155734607 0033714 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
class Less_Tree_Mixin_Definition extends Less_Tree_Ruleset{
public $name;
public $selectors;
public $params;
public $arity = 0;
public $rules;
public $lookups = array();
public $required = 0;
public $frames = array();
public $condition;
public $variadic;
public $type = 'MixinDefinition';
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition
public function __construct($name, $params, $rules, $condition, $variadic = false, $frames = array() ){
$this->name = $name;
$this->selectors = array(new Less_Tree_Selector(array( new Less_Tree_Element(null, $name))));
$this->params = $params;
$this->condition = $condition;
$this->variadic = $variadic;
$this->rules = $rules;
if( $params ){
$this->arity = count($params);
foreach( $params as $p ){
if (! isset($p['name']) || ($p['name'] && !isset($p['value']))) {
$this->required++;
}
}
}
$this->frames = $frames;
$this->SetRulesetIndex();
}
//function accept( $visitor ){
// $this->params = $visitor->visit($this->params);
// $this->rules = $visitor->visit($this->rules);
// $this->condition = $visitor->visit($this->condition);
//}
public function toCSS(){
return '';
}
// less.js : /lib/less/tree/mixin.js : tree.mixin.Definition.evalParams
public function compileParams($env, $mixinFrames, $args = array() , &$evaldArguments = array() ){
$frame = new Less_Tree_Ruleset(null, array());
$params = $this->params;
$mixinEnv = null;
$argsLength = 0;
if( $args ){
$argsLength = count($args);
for($i = 0; $i < $argsLength; $i++ ){
$arg = $args[$i];
if( $arg && $arg['name'] ){
$isNamedFound = false;
foreach($params as $j => $param){
if( !isset($evaldArguments[$j]) && $arg['name'] === $params[$j]['name']) {
$evaldArguments[$j] = $arg['value']->compile($env);
array_unshift($frame->rules, new Less_Tree_Rule( $arg['name'], $arg['value']->compile($env) ) );
$isNamedFound = true;
break;
}
}
if ($isNamedFound) {
array_splice($args, $i, 1);
$i--;
$argsLength--;
continue;
} else {
throw new Less_Exception_Compiler("Named argument for " . $this->name .' '.$args[$i]['name'] . ' not found');
}
}
}
}
$argIndex = 0;
foreach($params as $i => $param){
if ( isset($evaldArguments[$i]) ){ continue; }
$arg = null;
if( isset($args[$argIndex]) ){
$arg = $args[$argIndex];
}
if (isset($param['name']) && $param['name']) {
if( isset($param['variadic']) ){
$varargs = array();
for ($j = $argIndex; $j < $argsLength; $j++) {
$varargs[] = $args[$j]['value']->compile($env);
}
$expression = new Less_Tree_Expression($varargs);
array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $expression->compile($env)));
}else{
$val = ($arg && $arg['value']) ? $arg['value'] : false;
if ($val) {
$val = $val->compile($env);
} else if ( isset($param['value']) ) {
if( !$mixinEnv ){
$mixinEnv = new Less_Environment();
$mixinEnv->frames = array_merge( array($frame), $mixinFrames);
}
$val = $param['value']->compile($mixinEnv);
$frame->resetCache();
} else {
throw new Less_Exception_Compiler("Wrong number of arguments for " . $this->name . " (" . $argsLength . ' for ' . $this->arity . ")");
}
array_unshift($frame->rules, new Less_Tree_Rule($param['name'], $val));
$evaldArguments[$i] = $val;
}
}
if ( isset($param['variadic']) && $args) {
for ($j = $argIndex; $j < $argsLength; $j++) {
$evaldArguments[$j] = $args[$j]['value']->compile($env);
}
}
$argIndex++;
}
ksort($evaldArguments);
$evaldArguments = array_values($evaldArguments);
return $frame;
}
public function compile($env) {
if( $this->frames ){
return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $this->frames );
}
return new Less_Tree_Mixin_Definition($this->name, $this->params, $this->rules, $this->condition, $this->variadic, $env->frames );
}
public function evalCall($env, $args = NULL, $important = NULL) {
Less_Environment::$mixin_stack++;
$_arguments = array();
if( $this->frames ){
$mixinFrames = array_merge($this->frames, $env->frames);
}else{
$mixinFrames = $env->frames;
}
$frame = $this->compileParams($env, $mixinFrames, $args, $_arguments);
$ex = new Less_Tree_Expression($_arguments);
array_unshift($frame->rules, new Less_Tree_Rule('@arguments', $ex->compile($env)));
$ruleset = new Less_Tree_Ruleset(null, $this->rules);
$ruleset->originalRuleset = $this->ruleset_id;
$ruleSetEnv = new Less_Environment();
$ruleSetEnv->frames = array_merge( array($this, $frame), $mixinFrames );
$ruleset = $ruleset->compile( $ruleSetEnv );
if( $important ){
$ruleset = $ruleset->makeImportant();
}
Less_Environment::$mixin_stack--;
return $ruleset;
}
public function matchCondition($args, $env) {
if( !$this->condition ){
return true;
}
// set array to prevent error on array_merge
if(!is_array($this->frames)) {
$this->frames = array();
}
$frame = $this->compileParams($env, array_merge($this->frames,$env->frames), $args );
$compile_env = new Less_Environment();
$compile_env->frames = array_merge(
array($frame) // the parameter variables
, $this->frames // the parent namespace/mixin frames
, $env->frames // the current environment frames
);
$compile_env->functions = $env->functions;
return (bool)$this->condition->compile($compile_env);
}
public function matchArgs($args, $env = NULL){
$argsLength = count($args);
if( !$this->variadic ){
if( $argsLength < $this->required ){
return false;
}
if( $argsLength > count($this->params) ){
return false;
}
}else{
if( $argsLength < ($this->required - 1)){
return false;
}
}
$len = min($argsLength, $this->arity);
for( $i = 0; $i < $len; $i++ ){
if( !isset($this->params[$i]['name']) && !isset($this->params[$i]['variadic']) ){
if( $args[$i]['value']->compile($env)->toCSS() != $this->params[$i]['value']->compile($env)->toCSS() ){
return false;
}
}
}
return true;
}
}