Implements \Phergie\Irc\GeneratorInterface->ctcpVersionResponse().

@param string $nickname
@param string $name
@param string $version
@param string $environment
342233
public function ctcpVersionResponse($nickname, $name, $version, $environment)
    {
        $this->queueCtcpResponse('VERSION', [ $nickname, $name, $version, $environment ]);
    }
1227237
public static function setApplicationVersion(string $version): void
    {
        if (self::isCliApp()) {
            self::$APPLICATION_VERSION = $version;
        } else {
            MSession::set(MCoreApplication::APPLICATION_VERSION, $version);
        }
    }
1003919
public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null)
    {

        $options = [
            'form_params' => [
                'source' => $environmentFromUuid,
                'message' => $commitMessage,
            ],
        ];

        return new OperationResponse(
            $this->connector->request(
                'post',
                "/environments/${environmentToUuid}/code",
                $this->query,
                $options
            )
        );
    }
444967
public function getClientKey($uuid, $edition, $version)
    {
        $endPointUrl = $this->apiurl."/client/key/".$uuid."?edition=".$edition."&version=".$version;

        $response = $this->curlGet($endPointUrl);

        return $response;
    }
788594
public function switchCode($environmentUuid, $branch)
    {

        $options = [
            'form_params' => [
                'branch' => $branch,
            ],
        ];

        return new OperationResponse(
            $this->connector->request(
                'post',
                "/environments/${environmentUuid}/code/actions/switch",
                $this->query,
                $options
            )
        );
    }
370444
protected function setEnvironmentVariable($name, $value)
    {
        $name = strtoupper($name);
        $result = putenv("$name=$value");

        if ($result === false) {
            throw new Exception\RuntimeException(
                sprintf('Failed to set environment variable "%s"', $name)
            );
        }
    }
869350
public static Specification<JpaDistributionSet> equalsNameAndVersionIgnoreCase(final String name,
            final String version) {
        return (targetRoot, query, cb) -> cb.and(
                cb.equal(cb.lower(targetRoot.<String> get(JpaDistributionSet_.name)), name.toLowerCase()),
                cb.equal(cb.lower(targetRoot.<String> get(JpaDistributionSet_.version)), version.toLowerCase()));

    }
1373907
private static void writeVersionToVerFile(String version) throws IOException {
        //declared in a try-with-resource statement, it will be closed regardless of it completes normally or not      
    	try (PrintWriter writer = new PrintWriter(new File(DoradusServer.class.getResource("/" + VERSION_FILE).getPath()))) {
    		writer.write(version);
    	}

    }
682874
public function Font(Environment $environment, $name)
    {
        //Returns the font code
        $render = $environment->render('@c975LIncludeLibrary/fragments/font.html.twig', array(
            'name' => str_replace(' ', '+', $name),
            ));

        return str_replace(array("\n", '  ', '  ', '  ', '  ', '  '), ' ', $render);
    }
1052830
protected function setVersion($version) {
		$this->version = $version;

		$numbers = explode('.', $version);

		// Update Mayor and Minor-Version-Numbers
		$this->setMayor((int) $numbers[0]);
		$this->setMinor((int) $numbers[1]);
	}
199256
public function run($version)
    {
        $versions = array();
        $iterator = new \DirectoryIterator($this->migrationsDir);
        foreach ($iterator as $fileinfo) {
            if (!$fileinfo->isDir()) {
                $versions[] = str_replace('.php', '', $fileinfo->getFilename());
            }
        }

        /** @var Mysql $connection */
        $connection = $this->getDI()->get($this->migrationAdapter);
        try {
            $lastMig = $connection->fetchOne('SELECT * FROM migration ORDER BY id DESC', \PDO::FETCH_ASSOC);
        } catch (\PDOException $ex) {
            if ($this->migrationAdapter === 'dbMysql') {
                $connection->query('CREATE TABLE migration (`id` INT NOT NULL AUTO_INCREMENT,`version` VARCHAR(45) NOT NULL,`run_at` DATETIME NOT NULL, PRIMARY KEY (`id`))');
            } else {
                $connection->query('CREATE TABLE "public"."migration" ("id" SERIAL NOT NULL,"version" CHARACTER VARYING(45),"run_at" TIMESTAMP,PRIMARY KEY ("id"));');
            }

        }

        if (isset($lastMig)) {
            $fromVersion = $lastMig['version'];
        } else {
            $fromVersion = '0';
        }

        $toZero = false;
        if (count($versions) == 0) {
            throw new CommandsException('Migrations were not found at ' . $this->migrationsDir);
        } else {
            if ($version === null) {
                $version = Version::maximum($versions);
            } else {
                if ($version == '0') {
                    $toZero = true;
                    $versionsSorted = Version::sortAsc($versions);
                    $version = $versionsSorted[0];

                } elseif ($version === 'up') {
                    $versionsSorted = Version::sortAsc($versions);
                    foreach ($versionsSorted as $k => $v) {
                        if ($v === $fromVersion) {
                            $currentK = $k;
                        }
                    }
                    $version = isset($versionsSorted[$currentK + 1]) ? $versionsSorted[$currentK + 1] : Version::maximum($versions);
                } elseif ($version === 'down') {
                    $versionsSorted = Version::sortAsc($versions);
                    foreach ($versionsSorted as $k => $v) {
                        if ($v === $fromVersion) {
                            $currentK = $k;
                        }
                    }
                    $version = isset($versionsSorted[$currentK - 1]) ? $versionsSorted[$currentK - 1] : $versionsSorted[0];
                }
                $migrationPath = $this->migrationsDir . '/' . $version . '.php';
                if (!file_exists($migrationPath)) {
                    throw new CommandsException('Migration class was not found ' . $migrationPath);
                }
            }
        }

        $versionsBetween = Version::between($fromVersion, $version, $versions);
        if ($toZero === true) {
            $theTwoFirstMigrations = [];
            $theTwoFirstMigrations[] = $versionsBetween[count($versionsBetween) - 1];
            $versionsBetween = $theTwoFirstMigrations;
        }


        try {
            $direction = 'up';
            foreach ($versionsBetween as $k => $v) {
                $migrationPath = $this->migrationsDir . '/' . $v['version'] . '.php';
                $this->_migrateFile((string)$v['version'], $migrationPath, $v['direction']);
                if ($v['direction'] === 'down' && $k === 0) {
                    $direction = $v['direction'];
                    continue;
                } else {
                    $connection->insert("migration", array((string)$v['version'], date('Y-m-d H:i:s')), array("version", "run_at"));
                }
                $direction = $v['direction'];

            }
            if (count($versionsBetween) > 0 && $direction === 'down') {
                $connection->insert("migration", array((string)$version, date('Y-m-d H:i:s')), array("version", "run_at"));
            } elseif (count($versionsBetween) === 0) {
                print Color::colorize('No migration to run' . PHP_EOL . PHP_EOL, Color::FG_GREEN);
            }
            exit(0);
        } catch (\Throwable $e){
            print PHP_EOL . Color::error($e->getMessage()) . PHP_EOL;
            exit(1);
        }

    }
1172658
public static function initByVersion( string $version, array $customSettings = [] )
	{
		self::setSettings([
			self::SET_VERSION  => $version,
			self::SET_ENDPOINT => self::getCdnUrl(),
		]);

		if (!empty($customSettings))
			self::setSettings($customSettings);

		self::$initialized = true;
	}
1236495
public function resolve(string $namespace, string $version, string $name): string
    {
        $class = str_replace('.', '\\', $name);

        if (! array_key_exists($version, $this->supportedVersions)) {
            $version = $this->defaultVersion;
        }

        return sprintf('%s\%s\%s\%s', $namespace, $this->supportedVersions[$version], $class);
    }
971430
public function activate($versionNumber, $oldVersionNumber = '')
    {
        $runtimeManager = $this->framework->getRuntimeManager();
        $runtimeManager->addFilterHandler('\\Zepi\\Core\\AccessControl\\Filter\\AccessLevelManager\\RemoveAccessLevel', '\\Zepi\\Core\\AccessControl\\FilterHandler\\RevokePermissionsForRemovedAccessLevel');
        $runtimeManager->addFilterHandler('\\Zepi\\Turbo\\Filter\\VerifyEventName', '\\Zepi\\Core\\AccessControl\\FilterHandler\\CheckEventAccessForSession');
        
        $runtimeManager->addEventHandler('\\Zepi\\Core\\AccessControl\\Event\\RedirectRequestWithoutSession', '\\Zepi\\Core\\AccessControl\\EventHandler\\RedirectRequestWithoutSession');
        $runtimeManager->addEventHandler('\\Zepi\\Core\\AccessControl\\Event\\DisplayNoAccessMessage', '\\Zepi\\Core\\AccessControl\\EventHandler\\DisplayNoAccessMessage');
        
        // Data Sources
        $dataSourceManager = $this->framework->getDataSourceManager();
        $dataSourceManager->addDataSource(
            '\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceInterface',
            '\\Zepi\\DataSource\\Doctrine',
            '\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceDoctrine'
        );
        
        $dataSourceManager->addDataSource(
            '\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceInterface',
            '\\Zepi\\DataSource\\Doctrine',
            '\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceDoctrine'
        );
        
        // Access Levels
        $accessLevelsManager = $this->framework->getInstance('\\Zepi\\Core\\AccessControl\\Manager\\AccessLevelManager');
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\*',
            'Global Super User',
            'Super user privileges. Can do everything.',
            '\\Zepi\\Core\\AccessControl'
        ));
        
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\Disabled',
            'Disabled User',
            'A disabled user. Can do nothing, not even login.',
            '\\Zepi\\Core\\AccessControl'
        ));
        
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\Active',
            'Active User',
            'A active user. Can login and change the user password.',
            '\\Zepi\\Core\\AccessControl'
        ));
    }
363344
public function withProtocolVersion($version)
    {
        $response = $this->_withProtocolVersion($version);
        
        if ($response->status instanceof GlobalResponseStatus) {
            $response->status = $response->status->withProtocolVersion($response->getProtocolVersion());
        }
        
        return $response;
    }
13566
protected function printPendingVersion(Version $version, $style)
    {
        /** @var Version $version */
        $id = $version->getId();
        $reflectionClass = new \ReflectionClass($version->getMigration());
        $absolutePath = $reflectionClass->getFileName();
        $fileName = $absolutePath ? $this->getRelativePath(getcwd(), $absolutePath) : '';
        $this->output->writeln("\t<$style>[$id] $fileName</$style>");
    }
312850
protected function postProcess($packageName, Version $version)
    {
        $this->comment('Processing package...');

        $specials = $this->resolver->specials($packageName, $version);

        if ($specials === false) {
            $this->info("No Service Providers and Facades found. Assuming that package is not designed for Laravel");
            $this->info('Finishing');
            exit;
        }

        if ($this->resolver->isProvidesJsonDetected()) {
            $this->comment('provides.json detected');
        }

        if (count($specials['providers'])) {
            $this->comment('Found ' . count($specials['providers']) . ' service providers:');
            foreach ($specials['providers'] as $i => $p) {
                $this->info("[" . ($i + 1) . "] {$p}");
                $this->config->addProvider($p);
            }
        }
        if (count($specials['aliases'])) {
            $this->comment('Found ' . count($specials['aliases']) . ' aliases:');
            foreach ($specials['aliases'] as $i => $alias) {
                $this->info("[" . ($i + 1) . "] {$alias['facade']} [{$alias['alias']}]");
                $this->config->addAlias($alias['alias'], $alias['facade']);
            }
        }

        // publish configs and assets
        try {
            $this->call('config:publish', array('package' => $packageName));
        } catch (Exception $e) {
            $this->comment($e->getMessage());
        }
        try {
            $this->call('asset:publish', array('package' => $packageName));
        } catch (Exception $e) {
            $this->comment($e->getMessage());
        }

    }