TODO: Duplicate in CanalTPMttBundle:Network (controller)
763852
public function byCoverageAction($externalCoverageId)
    {
        $response = new JsonResponse();
        $navitia = $this->get('sam_navitia');
        $nmmToken = $this->get('service_container')->getParameter('nmm.navitia.token');
        $status = Response::HTTP_FORBIDDEN;

        $navitia->setToken($nmmToken);
        try {
            $networks = $navitia->getNetworks($externalCoverageId);
            asort($networks);
        } catch (\Navitia\Component\Exception\NavitiaException $e) {
            $response->setData(array('status' => $status));
            $response->setStatusCode($status);

            return $response;
        }

        $status = Response::HTTP_OK;
        $response->setData(
            array(
                'status' => $status,
                'networks' => $networks
            )
        );
        $response->setStatusCode($status);

        return $response;
    }
212986
public function onKernelController(FilterControllerEvent $event)
    {
        $controller = $event->getController();

        /*
         * $controller passed can be either a class or a Closure.
         * This is not usual in Symfony but it may happen.
         * If it is a class, it comes in array format
         */
        if (!is_array($controller)) {
            return;
        }
        $fqcn = get_class($controller[0]);
        $isMediaManagerBundleController = $this->startsWith($fqcn, 'Phlexible\Bundle\MediaManagerBundle\Controller');
        if ($isMediaManagerBundleController && !$this->checkDefaultVolumeExists()) {
            throw new \Exception('No default volume found. Maybe you haven\'t initialized the MediaManager yet?');
        }
    }
623031
public static function factory($host, $port, $sendTimeout = null, $receiveTimeout = null, $framedTransport = false)
    {
        $socket = self::createSocket($host, $port, $sendTimeout, $receiveTimeout);
        $transport = self::createTransport($socket, $framedTransport);
        $protocol = new TBinaryProtocolAccelerated($transport);
        $client = new RestClient($protocol);
        $transport->open();

        return $client;
    }
1211720
public function add($uri, $method, $controller, $action) {
        $this->currentRoute = [
            'uri' => $uri,
            'method' => $method,
            'controller' => $controller,
            'action' => $action,
            'module' => $this->module,
        ];

        if ($this->currentGroupName) {
            $this->virtualRoutes[$this->currentGroupName][] = $this->currentRoute;
        } else {
            $this->virtualRoutes['*'][] = $this->currentRoute;
        }

        return $this;
    }
1048020
public function bindParam($paramno, &$param, $type = null, $maxlen = null, $driverdata = null)
    {
        $log = 'Binding Parameters: ' . $paramno . '=' . $param;
        if (!is_null($type)) {
            $log .= '| Type: ' . $type;
        }
        if (!is_null($maxlen)) {
            $log .= '| Maxlen: ' . $maxlen;
        }

        if (!is_null($driverdata)) {
            $log .= '| DriverData: ' . $driverdata;
        }
        $this->connection->writeToLog($log);

        if (!empty($type)) {
            return parent::bindParam($paramno, $param, $type, $maxlen, $driverdata);
        }

        return parent::bindParam($key, $val);
    }
61105
public function play(): ControllerInterface
    {
        try {
            $this->soap("AVTransport", "Play", [
                "Speed" =>  1,
            ]);
        } catch (SoapException $e) {
            if (count($this->getQueue()) < 1) {
                $e = new \BadMethodCallException("Cannot play, the current queue is empty");
            }
            throw $e;
        }

        return $this;
    }
943525
@Override
	public void writeBundleTo(String bundlePath, Writer writer) throws ResourceNotFoundException {

		Reader rd = null;

		try {

			// If debug mode is on, resources are retrieved one by one.
			if (config.isDebugModeOn()) {

				rd = resourceHandler.getResource(null, bundlePath);
			} else {

				for (String prefix : bundlePrefixes) {
					if (bundlePath.startsWith(prefix)) {
						bundlePath = bundlePath.substring(prefix.length());
						break;
					}
				}

				// Prefixes are used only in production mode
				String path = PathNormalizer.removeVariantPrefixFromPath(bundlePath);
				rd = resourceBundleHandler.getResourceBundleReader(path);
				if (liveProcessBundles.contains(path)) {
					rd = processInLive(rd);
				}
			}

			IOUtils.copy(rd, writer);
			writer.flush();
		} catch (IOException e) {
			throw new BundlingProcessException("Unexpected IOException writing bundle[" + bundlePath + "]", e);
		} finally {
			IOUtils.close(rd);
			IOUtils.close(writer);
		}
	}
699533
public function connect($template, $name, $controller=null, $metadata=array())
	{
		if(is_object($template))
			$this->_customRoutes[$name] = $template;
		else
			$this->_routes[$name] = new Route($name, $template);

		if($metadata)
			$this->_metadata[$name] = $metadata;

		if($controller)
			$this->_controllers[$name] = $controller;

		return $this;
	}
340046
@Override
	public void writeBundleTo(String bundlePath, Writer writer) throws ResourceNotFoundException {
		
		String text = (String) cacheMgr.get(TEXT_CACHE_PREFIX + bundlePath);
		try {
			// If it's not cached yet
			if (null == text) {
				String charsetName = rsHandler.getConfig().getResourceCharset().name();
				ByteArrayOutputStream baOs = new ByteArrayOutputStream();
				WritableByteChannel wrChannel = Channels.newChannel(baOs);
				Writer tempWriter = Channels.newWriter(wrChannel, charsetName);
				rsHandler.writeBundleTo(bundlePath, tempWriter);
				text = baOs.toString(charsetName);
				cacheMgr.put(TEXT_CACHE_PREFIX + bundlePath, text);
			}

			// Write the text to the outputstream
			writer.write(text);
			writer.flush();

		} catch (IOException e) {
			throw new BundlingProcessException("Unexpected IOException writing bundle[" + bundlePath + "]", e);
		}finally {
			IOUtils.close(writer);
		}
	}
1038540
@Override
    public ChannelFuture block(
            InetAddress multicastAddress, NetworkInterface networkInterface,
            InetAddress sourceToBlock, ChannelPromise promise) {
        checkJavaVersion();

        if (multicastAddress == null) {
            throw new NullPointerException("multicastAddress");
        }
        if (sourceToBlock == null) {
            throw new NullPointerException("sourceToBlock");
        }

        if (networkInterface == null) {
            throw new NullPointerException("networkInterface");
        }
        synchronized (this) {
            if (memberships != null) {
                List<MembershipKey> keys = memberships.get(multicastAddress);
                for (MembershipKey key: keys) {
                    if (networkInterface.equals(key.networkInterface())) {
                        try {
                            key.block(sourceToBlock);
                        } catch (IOException e) {
                            promise.setFailure(e);
                        }
                    }
                }
            }
        }
        promise.setSuccess();
        return promise;
    }
1093987
function preloadRoute(json, router, controllers) {
  // 支持 '/router get func' 这种配置
  if (isString(json)) {
    let arr = json.split(/\s+/);
    const obj = {};
    obj.path = arr[0];
    switch (arr.length) {
      case 2:
        obj.controller = arr[1];
        break;
      case 3:
        obj.method = arr[1];
        obj.controller = arr[2];
        break;
    }
    json = obj;
  }
  if (isUndefined(json.path)) {
    forEach(json, (val, key) => _preloadRoute(adaptForRouter(val, key), router, controllers));
  } else {
    _preloadRoute(json, router, controllers);
  }
}
1275711
private function createDefaultControllerMvcFile()
    {
        $moduleName = ucfirst($this->getModule());
        $moduleNameLower = strtolower($this->getModule());
        $moduleNameUpper = strtoupper($this->getModule());

        $moduleControllerFolder = MODULES_PATH . ucfirst($this->getModule()) . DS . 'src' . DS . ucfirst($this->getModule()) . DS . 'Controller';

        /* Criação do arquivo de controller padrão do módulo */
        $cityware_mvc_controller = file_get_contents(dirname(__FILE__) . DS . 'Module' . DS . 'Cityware_Mvc_Controller.tpl');
        $citywareMvcController = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameUpper%", $moduleNameUpper, str_replace("%moduleNameLower%", $moduleNameLower, $cityware_mvc_controller)));
        file_put_contents($moduleControllerFolder . DS . 'AbstractActionController'.$moduleName.'.php', $citywareMvcController);
        chmod($moduleControllerFolder . DS . 'AbstractActionController'.$moduleName.'.php', 0644);
    }
1095449
public function put(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::PUT, $module, $controller);
    }
1366163
@Override
	public WebMvcLinkBuilder linkTo(Class<?> controller, Map<String, ?> parameters) {
		return WebMvcLinkBuilder.linkTo(controller, parameters);
	}
189279
public function createApplication(ObjectManager $om, $name, $route, $reference = null, $bundleName = null)
    {
        $canonicalName = strtolower(($reference === null) ? $name : $reference);
        $entity = $om->getRepository('CanalTPSamCoreBundle:Application')->findOneByCanonicalName($canonicalName);
        if (is_null($entity)) {
            $entity = new Application($name);
            $entity->setDefaultRoute($route);
            $entity->setCanonicalName($canonicalName);
            $entity->setBundleName($bundleName);

            $om->persist($entity);
        }

        $this->addReference('app-' . $entity->getCanonicalName(), $entity);
    }
162625
public function setController(string $controller): RouteInterface
   {
       if (!preg_match(
               "/^([A-Z]{1}[a-zA-Z_0-9]{1,31}(\/{1})?){1,3}$/",
               $controller)) {
           throw new InvalidArgumentException(
               "Can't set controller: invalid relative controller class name "
             . $controller);
       }
       $this->controller = rtrim($controller, "/");
       return $this;
   }
178975
public static function Connection () {
		\ickx\fw2\router\Router::Connect('/{:controller}/{:action}/{:args}');
		\ickx\fw2\router\Router::Connect('/{:args}');
	}