@param Tool $tool
@param $name
@param bool $executeQuery

@return ToolMaskDecoder
190196
public function getMaskDecoderByToolAndName(
        Tool $tool,
        $name,
        $executeQuery = true
    ) {
        return $this->maskRepo->findMaskDecoderByToolAndName(
            $tool,
            $name,
            $executeQuery
        );
    }
524331
public function call(ExpandableInterface $object, $name, array $args)
    {
        if (!$this::exists($name)) {
            throw new \BadMethodCallException(sprintf(self::MSG_NO_EXTENSION_TOCALL, $name), 110);
        }
        
        $closure = $this->extensions->get($name);
        
        return call_user_func_array(\Closure::bind($closure, $object, get_class($object)), $args);
    }
364709
public function table($name, $callback = null)
    {   
        if (! $callback instanceof \Closure) {
            throw InvalidArgumentPassedException::isNotClosure();
        }

        $this->setTableName($name);

        $callback($this);
        
        $tableNamePrefixed = $this->getTableNamePrefix($this->getTableName());
        $tableStructure = \substr($this->getColumnsQuery() . $this->getPrimaryKeyQuery(), 0, -2);
        $tableCharsetCollate = $this->getCharacterSetCollate();

        $this->buildCreateTableQuery($tableNamePrefixed, $tableStructure, $tableCharsetCollate);

        $this->flushColumns();
        $this->flushPrimaryKey();
    }
1311118
public function handleMagicMethods($name, array $arguments)
    {
        $flag = false;
        $result = null;

        if (in_array($type = substr($name, 0, 3), ['set', 'get'])) {
            /*
             * We will first try to access the property written with
             * lowerCamelCase, which is the convention for many people. If this
             * property is not found, we try the real name of the property given
             * in the magic method.
             */
            $propertyLowerCase = lcfirst(substr($name, 3));
            $property = substr($name, 3);

            foreach ([$propertyLowerCase, $property] as $prop) {
                try {
                    $result = $this->handlePropertyMagicMethod($prop, $type, $arguments);
                    $flag = true;
                    break;
                } catch (PropertyNotAccessibleException $e) {
                    continue;
                }
            }
        }

        if (false === $flag) {
            throw new MethodNotFoundException(
                'The method "' . $name . '" does not exist in the class "' . get_class($this) . '".',
                1471043854
            );
        }

        return $result;
    }
893289
protected function encodeSimpleControl($name, AbstractControl $control, Encoder $encoder, $flags = null)
    {
        $buffer = sprintf(
            '%s = L.%s(%s)%s',
            $encoder->encodeReference($control),
            $name,
            $encoder->encodeValue($control->getOptions()),
            $encoder->close($flags)
        );

        $buffer .= $this->encodeMethodCalls($control->getMethodCalls(), $encoder, $flags);

        return $buffer;
    }
1103831
public function createDefaultToolMaskDecoders(Tool $tool)
    {
        foreach (ToolMaskDecoder::$defaultActions as $action) {
            $maskDecoder = $this->maskRepo
                ->findMaskDecoderByToolAndName($tool, $action);

            if (is_null($maskDecoder)) {
                $maskDecoder = new ToolMaskDecoder();
                $maskDecoder->setTool($tool);
                $maskDecoder->setName($action);
                $maskDecoder->setValue(ToolMaskDecoder::$defaultValues[$action]);
                $maskDecoder->setGrantedIconClass(
                    ToolMaskDecoder::$defaultGrantedIconClass[$action]
                );
                $maskDecoder->setDeniedIconClass(
                    ToolMaskDecoder::$defaultDeniedIconClass[$action]
                );
                $this->om->persist($maskDecoder);
            }
        }
        $this->om->flush();
    }
1352459
public function extractPlugin($name, $hash)
    {
        $fileCode = $name . $hash;
        $filePath = $this->getFilePath($fileCode);

        if (!Zip::extract($filePath, $this->baseDirectory . '/plugins/')) {
            throw new ApplicationException(Lang::get('system::lang.zip.extract_failed', ['file' => $filePath]));
        }

        @unlink($filePath);
    }
1136132
public function findByName($name, $extraDatas = array(), $executeQuery = true)
    {
        $name  = strtoupper($name);
        /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */
        $queryBuilder = $this->createQueryBuilder('resourceNode');
        $queryBuilder->where($queryBuilder->expr()->like('UPPER(resourceNode.name)', ':name'));

        if (0 < count($extraDatas)) {
            foreach ($extraDatas as $key => $extraData) {
                $queryBuilder
                    ->andWhere(sprintf('resourceNode.%s = :%s', $key, $key))
                    ->setParameter(sprintf(':%s', $key), $extraData);
            }
        }

        $queryBuilder
            ->orderBy('resourceNode.name', 'ASC')
            ->setParameter(':name', "%{$name}%");

        return $executeQuery ? $queryBuilder->getQuery()->getResult(): $queryBuilder;
    }
516675
def hide_tool(self, context_name, tool_name):
        
        data = self._context(context_name)
        hidden_tools = data["hidden_tools"]
        if tool_name not in hidden_tools:
            self._validate_tool(context_name, tool_name)
            hidden_tools.add(tool_name)
            self._flush_tools()
181124
public function getAction($name, $need = TRUE)
    {
        return $this->hasActions()
            ? $this->getComponent(Action::ID)->getComponent($name, $need)
            : NULL;
    }
127061
public function findSent(User $user, $executeQuery = true)
    {
        $dql = "
            SELECT um, m, u
            FROM Claroline\MessageBundle\Entity\UserMessage um
            JOIN um.user u
            JOIN um.message m
            WHERE u.id = {$user->getId()}
            AND um.isRemoved = false
            AND um.isSent = true
            ORDER BY m.date DESC
        ";
        $query = $this->_em->createQuery($dql);

        return $executeQuery ? $query->getResult() : $query;
    }
862516
public static function extend(BladeCompiler $blade, $name, $closure)
    {
        // For 5.0 after
        if (is_callable([$blade, 'directive'])) {
            $blade->directive($name, $closure);

            return;
        }

        // For 4.x before
        $blade->extend(
            function ($view, BladeCompiler $compiler) use ($name, $closure) {
                $pattern = $compiler->createMatcher($name);

                return preg_replace_callback(
                    $pattern,
                    function ($matches) use ($closure) {
                        if (empty($matches[2])) {
                            return $matches[0];
                        }

                        return $matches[1] . $closure($matches[2]);
                    },
                    $view
                );
            }
        );

        return;
    }
1278394
public static ClientSelector nameSelector(final String nameMask) {
        return new ClientSelector() {
            @Override
            public boolean select(Client client) {
                String name = client.getName();
                if (name == null) {
                    return false;
                }
                return name.matches(nameMask);
            }

            @Override
            public String toString() {
                return "ClientSelector{nameMask:" + nameMask + " }";
            }
        };
    }
306893
protected function hasQueryBuilderMethod(string $name) : bool
    {
        if (method_exists($this->queryBuilder, $name)) {
            return true;
        }

        if (method_exists($this->queryBuilder, 'hasMacro') && $this->queryBuilder->hasMacro($name)) {
            return true;
        }

        return false;
    }
204217
private function generateCommand($name, \ReflectionMethod $method, $token = null)
    {
        $methodName = $this->transformer->transform($method->getName());

        $command = new Command(strtolower($name . ':' . $methodName));

        $factory  = DocBlockFactory::createInstance();
        $docBlock = $factory->create($method);

        $command->setDefinition($this->buildDefinition($method, $docBlock, $token));
        $command->setDescription($docBlock->getSummary());
        $command->setCode($this->createCode($name, $method));

        return $command;
    }
776510
public function createIssueTracker($name, array $adapterConfig, Config $globalConfig)
    {
        $factory = $this->getFactoryObject($name);

        if (!$factory instanceof IssueTrackerFactory) {
            throw new \LogicException(sprintf('Adapter %s does not support issue-tracking.', $name));
        }

        return $factory->createIssueTracker($adapterConfig, $globalConfig);
    }
753175
private function methodInvoke($name, $namespace)
    {
        $name = ucfirst($name);

        $this->uses[] = $namespace . '\\' . $name;

        $namespace = '\\' . $namespace . '\\';

        $parameters = [
            new ParameterGenerator(
                'command', $namespace . $name
            ),
        ];

        return new MethodGenerator(
            '__invoke',
            $parameters,
            MethodGenerator::FLAG_PUBLIC,
            '',
            new DocBlockGenerator(
                'Handle command',
                null,
                [
                    new ParamTag('command', [ $namespace . $name]),
                ]
            )
        );
    }