{@inheritDoc}

@SuppressWarnings(PHPMD.UnusedFormalParameter)
165772
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $translationMode = $input->getOption('mode');

        // HOTFIX: translated actually appears to be "translator".
        if ($translationMode == 'translated') {
            $translationMode = 'translator';
        }

        $allLanguages = ($input->getArgument('languages') == 'all');

        $project = new Project($this->getApi());

        $project->setSlug($this->project);

        $resources = $project->getResources();

        foreach ($resources as $resource) {
            $this->handleResource($resource, $translationMode, $allLanguages, $output);
        }
    }
599060
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return array_map(
            static function (Parameter $parameter) use ($subVisitor) {
                return $subVisitor->visit($parameter);
            },
            $value->getParameters()
        );
    }
621504
public function resolveMapping($resource, $parameters = [], $key = 'default', $method = null)
	{
		$resourceName = $resource;

		if( is_object($resource) )
		{
			$resourceName = get_class($resource);
		}

		$mappings = $this->getMappings($resourceName, $key);

		if(empty($mappings))
		{
			throw new Exception('No resolvers mapped for resource: ' . $resourceName . '.');
		}

		$result = null;

		if(is_array($mappings))
		{
			return $this->runResolver($mappings[0], $parameters, $method);
		}

		return $this->runResolver($mappings, $parameters, $method);
	}
1325454
public function processValue( $value,
                                  ZipArchive $zip,
                                  array $substitutions,
                                  array $domains,
                                  $dbSchema,
                                  array $paragraphIdMap = null)
    {
        if ( empty( $substitutions ) )
        {
            return $value;
        }

        $base       = static::PUBLIC_DIR . static::UPLOADS_DIR;
        $siteInfo   = $this->getSiteInfo();
        $importDir  = null;

        foreach ( $substitutions as $original => $file )
        {
            $stats = $zip->statName( $file, ZipArchive::FL_NOCASE );

            if ( ! empty( $stats ) && isset( $stats['index'] ) )
            {
                $contents   = null;
                $file       = trim( $stats['name'], '/' );

                if ( $siteInfo->getSchema() == $dbSchema &&
                     substr( $file, 0, strlen( $base ) ) == $base &&
                     is_file( $file ) &&
                     filesize( $file ) == $stats['size']  )
                {
                    $contents = $zip->getFromIndex( $stats['index'] );

                    if ( file_get_contents( $file ) == $contents )
                    {
                        $contents = null;
                        continue;
                    }
                }

                if ( null === $importDir )
                {
                    $importDir = static::UPLOADS_DIR
                               . $siteInfo->getSchema()
                               . '/pages/imports/'
                               . (new DateTime)->toHash() . '/';

                    if ( ! is_dir( static::PUBLIC_DIR . $importDir ) )
                    {
                        @mkdir( static::PUBLIC_DIR . $importDir, 0777, true );
                    }
                }

                $info   = pathinfo( $file );
                $name   = str_replace( '%', '.', rawurlencode( $info['filename'] ) );
                $ext    = '';
                $suffix = '';

                if ( isset( $info['extension'] ) )
                {
                    $ext = '.' . str_replace( '%', '.', rawurlencode( $info['extension'] ) );
                }

                while ( is_file( static::PUBLIC_DIR . $importDir . $name . $suffix . $ext ) )
                {
                    --$suffix;
                }

                $url    = $importDir . $name . $suffix . $ext;
                $path   = static::PUBLIC_DIR . $url;

                if ( $contents )
                {
                    $write = false !== file_put_contents( $path, $contents );
                }
                else if ( is_resource( $source = $zip->getStream( $stats['name'] ) ) )
                {
                    $destination = @fopen( $path, 'w' );

                    if ( is_resource( $destination ) )
                    {
                        $write = stream_copy_to_stream( $source, $destination );
                        fclose( $destination );
                    }
                    else
                    {
                        $write = false;
                    }

                    fclose( $source );
                }
                else
                {
                    $write = false;
                }

                if ( $write )
                {
                    $value = str_replace( $original, '/' . $url, $value );
                }
            }
        }

        foreach ( $domains as $domain )
        {
            if ( $domain === $siteInfo->getDomain() )
            {
                continue;
            }

            $value = preg_replace_callback(
                '((https?://)([^/:]+?\.)?'
                    . preg_quote( $domain )
                    . '(:\d+)?/?)i',
                function ( $matches ) use ( $siteInfo )
                {
                    return $siteInfo->getSubdomainUrl(
                        empty( $matches[2] ) ? '' : $matches[2],
                        true
                    );
                },
                $value
            );
        }

        return $value;
    }
272992
static function checkRequiredParametersAreSet(array $given, array $required)
    {
        foreach ($required as $key) {
            if (empty($given[$key])) {
                throw new MissingRequiredParameterException(
                        "Missing required parameter '$key'"
                );
            }
        }
    }
976112
function data($items = null): array
    {
        $this->putRetainedFilterValuesInSession();

        $items = $items ?: $this->getListData(
            EntityListQueryParams::create()
                ->setDefaultSort($this->defaultSort, $this->defaultSortDir)
                ->fillWithRequest()
                ->setDefaultFilters($this->getFilterDefaultValues())
        );

        if($items instanceof LengthAwarePaginator) {
            $page = $items->currentPage();
            $totalCount = $items->total();
            $pageSize = $items->perPage();
            $items = $items->items();
        }

        $this->addInstanceCommandsAuthorizationsToConfigForItems($items);

        $keys = $this->getDataKeys();

        return [
            "items" =>
                collect($items)
                    ->map(function($row) use($keys) {
                        // Filter model attributes on actual form fields
                        return collect($row)->only(
                            array_merge(
                                $this->entityStateAttribute ? [$this->entityStateAttribute] : [],
                                $this->multiformAttribute ? [$this->multiformAttribute] : [],
                                [$this->instanceIdAttribute],
                                $keys
                            )
                        )->all();
                    })->all()
        ] + (isset($page) ? compact('page', 'totalCount', 'pageSize') : []);
    }
1031791
public function getSourceModelArray($modelRef, $useCollection = false, $trimEmptyValues = false)
    {
        $model = Mage::getSingleton($modelRef);
        if (!$model) {
            throw new RuntimeException($this->__('Could not create source model (%s)', $modelRef));
        }

        $useCollection = (bool)$useCollection;

        if ($useCollection) {
            if (!$model instanceof Mage_Core_Model_Abstract) {
                throw new RuntimeException($this->__('Invalid source model type (%s)', $modelRef));
            }

            $collection = $model->getCollection();
            if (!$collection) {
                throw new RuntimeException($this->__('Could not create collection for source model (%s)', $modelRef));
            }

            $model = $collection;
        }

        $additionalArgs = func_get_args();
        array_shift($additionalArgs);
        array_shift($additionalArgs);
        array_shift($additionalArgs);

        if (method_exists($model, 'toOptionArray')) {
            $optionArray = call_user_func_array([$model, 'toOptionArray'], $additionalArgs);
        } elseif (method_exists($model, 'toOptionHash')) {
            $optionHash = call_user_func_array([$model, 'toOptionHash'], $additionalArgs);
            $optionArray = [];
            foreach ($optionHash as $value => $label) {
                $optionArray[] = [
                    'value' => $value,
                    'label' => $label
                ];
            }
        } else {
            if ($useCollection) {
                throw new RuntimeException($this->__('Source model (%s) collection does not have required method toOptionArray or toOptionHash', $modelRef));
            } else {
                throw new RuntimeException($this->__('Source model (%s) does not have required method toOptionArray or toOptionHash', $modelRef));
            }
        }

        if ($trimEmptyValues) {
            foreach ($optionArray as $k => $option) {
                if ($option['value'] == '') {
                    unset($optionArray[$k]);
                }
            }
        }

        return $optionArray;
    }
344655
public static function unserialize($value, array $params)
    {
        if (empty($value)) {
            return null;
        }
        if (!empty($params['key'])) {
            return ArrayHelper::getValue(
                Serialize::unserialize($value, false),
                explode(Helper::getValue($params['separator'], '.'), $params['key'])
            );
        }

        return Serialize::unserialize($value, false);
    }
966858
public function _execute(array $params = null)
    {
        if (!$this->_stmt) {
            return false;
        }

        // if no params were given as an argument to execute(),
        // then default to the _bindParam array
        if ($params === null) {
            $params = $this->_bindParam;
        }
        // send $params as input parameters to the statement
        if ($params) {
            array_unshift($params, str_repeat('s', count($params)));
            $stmtParams = array();
            foreach ($params as $k => &$value) {
                $stmtParams[$k] = &$value;
            }
            call_user_func_array(
                array($this->_stmt, 'bind_param'),
                $stmtParams
                );
        }

        // execute the statement
        $retval = $this->_stmt->execute();
        if ($retval === false) {
            /**
             * @see Zend_Db_Statement_Mysqli_Exception
             */
            // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
            throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error, $this->_stmt->errno);
        }


        // retain metadata
        if ($this->_meta === null) {
            $this->_meta = $this->_stmt->result_metadata();
            if ($this->_stmt->errno) {
                /**
                 * @see Zend_Db_Statement_Mysqli_Exception
                 */
                // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
                throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error, $this->_stmt->errno);
            }
        }

        // statements that have no result set do not return metadata
        if ($this->_meta !== false) {

            // get the column names that will result
            $this->_keys = array();
            foreach ($this->_meta->fetch_fields() as $col) {
                $this->_keys[] = $this->_adapter->foldCase($col->name);
            }

            // set up a binding space for result variables
            $this->_values = array_fill(0, count($this->_keys), null);

            // set up references to the result binding space.
            // just passing $this->_values in the call_user_func_array()
            // below won't work, you need references.
            $refs = array();
            foreach ($this->_values as $i => &$f) {
                $refs[$i] = &$f;
            }

            $this->_stmt->store_result();
            // bind to the result variables
            call_user_func_array(
                array($this->_stmt, 'bind_result'),
                $this->_values
            );
        }
        return $retval;
    }
497732
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        if (null === $this->argumentResolver) {
            throw ResolverNotFoundExceptionFactory::createUnexpectedCall(__METHOD__);
        }

        $functionCall = $value->getFunctionCall();
        $arguments = $functionCall->getArguments();
        foreach ($arguments as $index => $argument) {
            if ($argument instanceof ValueInterface) {
                $resolvedSet = $this->argumentResolver->resolve($argument, $fixture, $fixtureSet, $scope, $context);

                $arguments[$index] = $resolvedSet->getValue();
                $fixtureSet = $resolvedSet->getSet();
            }
        }

        $context->markAsNeedsCompleteGeneration();
        $fixtureReferenceResult = $this->argumentResolver->resolve($value->getReference(), $fixture, $fixtureSet, $scope, $context);
        $context->unmarkAsNeedsCompleteGeneration();

        /** @var ResolvedFixtureSet $fixtureSet */
        list($instance, $fixtureSet) = [$fixtureReferenceResult->getValue(), $fixtureReferenceResult->getSet()];

        try {
            $resolvedValue = $instance->{$functionCall->getName()}(...$arguments);
        } catch (\Throwable $exception) {
            if (false === method_exists($instance, $functionCall->getName())) {
                throw NoSuchMethodExceptionFactory::createForFixture($fixture, $value);
            }

            throw UnresolvableValueExceptionFactory::create($value, 0, $exception);
        }

        return new ResolvedValueWithFixtureSet(
            $resolvedValue,
            $fixtureSet
        );
    }
842812
public function visit($value, ?VisitorInterface $subVisitor = null)
    {
        if ($subVisitor === null) {
            throw new RuntimeException('Implementation requires sub-visitor');
        }

        return [
            'id' => $value->getId(),
            'is_translatable' => $value->isTranslatable(),
            'is_always_available' => $value->isAlwaysAvailable(),
            'main_locale' => $value->getMainLocale(),
            'available_locales' => $value->getAvailableLocales(),
            'parameters' => $this->visitParameters($value, $subVisitor),
            'query_type' => $value->getQueryType()->getType(),
        ];
    }
337305
public function deactivateTcaFrontendGroupEnableFields(
        /** @noinspection PhpUnusedParameterInspection */
        &$parameters,
        /** @noinspection PhpUnusedParameterInspection */
        $parentObject
    ) {
        $this->originalTca = $GLOBALS['TCA'];

        foreach ($GLOBALS['TCA'] as $tableName => $tableConfiguration) {
            if (isset($GLOBALS['TCA'][$tableName]['ctrl']['enablecolumns']['fe_group'])) {
                unset($GLOBALS['TCA'][$tableName]['ctrl']['enablecolumns']['fe_group']);
            }
        }
    }
266642
public function bindParams($params)
    {
        $bindParams = [''];
        
        foreach ($params as $dbColumnName => $dbColumnValue) {
            $dbColumnValueAry = (!is_array($dbColumnValue)) ? [$dbColumnValue] : $dbColumnValue;
            
            $i = 1;
            foreach ($dbColumnValueAry as $dbColumnValueAryValue) {
                ${$dbColumnName . $i} = $dbColumnValueAryValue;
                
                if (is_numeric($dbColumnValueAryValue)) {
                    $bindParams[0] .= 'i';
                } else if (is_double($dbColumnValueAryValue)) {
                    $bindParams[0] .= 'd';
                } else if (is_string($dbColumnValueAryValue)) {
                    $bindParams[0] .= 's';
                } else if (is_null($dbColumnValueAryValue)) {
                    $bindParams[0] .= 's';
                } else {
                    $bindParams[0] .= 'b';
                }
                
                $bindParams[] = &${$dbColumnName . $i};
                $i++;
            }
        }
        
        call_user_func_array([$this->statement, 'bind_param'], $bindParams);
        
        return $this;
    }
565636
function DBParameter($param)
	{
		if (empty($this->settings[$param])) return false;
		$sql = $this->settings[$param][1];
		return $this->_DBParameter($sql);
	}
18622
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters ) {
        switch ($operatorName)
        {
            case 'washxml':
                $operatorValue = str_replace( array( '&', '"', "'", '<', '>' ), array( '&amp;', '&quot;', '&apos;', '&lt;', '&gt;' ), $operatorValue );
                break;
            case 'washxmlcomment':
                // in xml comments the -- string is not permitted
                $operatorValue = str_replace( '--', '_-', $operatorValue );
                break;
            case 'washxmlcdata':
                /// @todo
                eZDebug::writeWarning( 'Template operator washxmlcdata not yet implemented, it should not be used!', __METHOD__ );
                break;
            case 'xsdtype':
                $operatorValue = ggWSDLParser::phpType2xsdType( $operatorValue, $namedParameters['targetprefix'], $namedParameters['xsdprefix'], $namedParameters['soapencprefix'] );
                break;
            case 'classInspect':
                $operatorValue = ggeZWebservices::classInspect( $operatorValue );
                break;
        }
    }
244166
public function bindParam($paramNo, &$param, $type = null, $maxLength = null, $driverData = null)
    {
        $this->bindValue($paramNo, $param, $type);
        return true;
    }
433423
public function bind(array $param) {
		foreach ($param as $key => $value) {
			if (is_null($value)) {
				$type = \PDO::PARAM_NULL;
			} else if (is_bool($value)) {
				$type = \PDO::PARAM_BOOL;
			} else if (is_int($value)) {
				$type = \PDO::PARAM_INT;
			} else {
				$type = \PDO::PARAM_STR;
			}
			$this->result->bindValue(is_int($key) ? ++$key : $key, $value, $type);
		}
	}