_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q261000 | TwigView.loadTwig | test | public function loadTwig() {
$loader = new \Twig_Loader_Filesystem(
array (
$this->viewsFolder
)
);
// Set up environment
$params = array(
//'cache' => $this->viewsFolder . "cache",
);
$this->twig = new \Twig_Environm... | php | {
"resource": ""
} |
q261001 | AuthAPI.setDefaultLanguage | test | private function setDefaultLanguage($userId) {
if ($this->language !== null) {
$languageModel = new \Mmf\Language\LanguageModel($this->connection);
$userLanguageProperties = $languageModel->getUserLanguage($userId);
if ($userLanguageProperties !== false) {
$th... | php | {
"resource": ""
} |
q261002 | AuthAPI.checkIfTokenIsValidAndUpdateTheExpireDate | test | private function checkIfTokenIsValidAndUpdateTheExpireDate() {
$userInfo = $this->authModel->getRoleAndUserFromToken($this->token);
if ($userInfo === false) {
throw new AuthException('The token is not valid', 2000);
}
if ($userInfo['expire'] !== null &&
$userI... | php | {
"resource": ""
} |
q261003 | BasicViewAbstract.get | test | public function get($name, $template = '', $vars = array(), $globalScriptVars = '') {
if ($template !== '') {
$this->setTemplate($template);
}
//Creation the full path of the view
$path = $this->viewsFolder . '/html/' . $name;
//If exists vars to assign, we assing one... | php | {
"resource": ""
} |
q261004 | BasicViewAbstract.addJsVar | test | public function addJsVar($vars, $value, $encode = false) {
if (is_array($vars)) {
foreach ($vars as $key => $value) {
// if JSONencode it's enable then is because it doesn't want json_encode.
$this->addJsVar($key, $value);
}
} else { // apply the l... | php | {
"resource": ""
} |
q261005 | BasicViewAbstract.addScript | test | public function addScript($jsfile, $min = FALSE, $type = 'text/javascript') {
//Check if we must minified the style
$minTag = "<script type='$type' src='min/?f=" . $this->asset($jsfile, TRUE) . "' ></script>";
$maxTag = "<script type='$type' src='" . $this->asset($jsfile, TRUE) . "' ></script>";... | php | {
"resource": ""
} |
q261006 | BasicViewAbstract.addStyles | test | public function addStyles($cssfile, $min = FALSE) {
//Check if we must minified the style
$minTag = "<link href='min/?f=" . $this->asset($cssfile, TRUE) . "' rel='stylesheet' type='text/css'/>";
$maxTag = "<link href='" . $this->asset($cssfile, TRUE) . "' rel='stylesheet' type='text/css'/>";
... | php | {
"resource": ""
} |
q261007 | BasicViewAbstract.getFileContent | test | protected function getFileContent($path, $vars = array()) {
//If there is vars to assign.
if (is_array($vars)) {
foreach ($vars as $key => $value) {
/* @var $value BasicViewInterface */
//If is a view, get the content of the view.
if (is_objec... | php | {
"resource": ""
} |
q261008 | BasicViewAbstract.getContentWithTemplate | test | public function getContentWithTemplate() {
$vars = $this->viewVars;
//If there is vars to assign.
if (is_array($vars)) {
foreach ($vars as $key => $value) {
/* @var $value BasicViewInterface */
//If is a view, get the content of the view.
... | php | {
"resource": ""
} |
q261009 | BasicViewAbstract.getAllScripts | test | public function getAllScripts() {
$return = '';
foreach ($this->config->get('mvc')['defaultScripts'] as $script) {
//If the script includes the // is for example http or https absolute route
if (strpos($script, '//') !== FALSE) {
$return .= '<script type="text/jav... | php | {
"resource": ""
} |
q261010 | BasicViewAbstract.getAllCss | test | public function getAllCss() {
$return = '';
foreach ($this->config->get('mvc')['defaultCSS'] as $script) {
//If the script includes the // is for example http or https absolute route
if (strpos($script, '//') !== FALSE) {
$return .= "<link href='" . $script . "' r... | php | {
"resource": ""
} |
q261011 | BasicViewAbstract.asset | test | public function asset($path = "/", $return = FALSE) {
$installFolder = $this->config->get('mvc')['installFolder'];
if (!$return) {
echo $installFolder . $path;
}
return $installFolder . $path;
} | php | {
"resource": ""
} |
q261012 | ACL.isAllowed | test | public function isAllowed(RoutingRuleAbstract $routingRule) {
$controller = $routingRule->getController();
if (substr($controller, -10) == "Controller") {
$controller = substr($controller,0, -10);
}
//$function = new \ReflectionClass($routingRule->getController() . '... | php | {
"resource": ""
} |
q261013 | ACL.getAccess | test | private function getAccess() {
if (is_null($this->access)) {
$chain = $this->getRolesChain();
$tmpAccess = array();
foreach ($chain as $role) {
$arrAccess = $this->aclModel->getAccessForARole($role['id_role']);
foreach ($arrAccess as $accessIt... | php | {
"resource": ""
} |
q261014 | ACL.getRolesChain | test | private function getRolesChain() {
if (is_null($this->rolesChain)) {
$chain = array();
$role = $this->aclModel->getRoleById($this->roleId);
while ($role != FALSE) {
$chain[] = $role;
$currId = $role['id_parent'];
$role = $this->... | php | {
"resource": ""
} |
q261015 | LanguageModel.getUserLanguage | test | public function getUserLanguage($userId) {
$sql = 'SELECT language.id_language,
language.name,
language.code,
language.default
FROM user
INNER JOIN language ON language.id_language = user.id_language
... | php | {
"resource": ""
} |
q261016 | Translator.translateChoice | test | public function translateChoice($id, $number, array $parameters = array(), $locale = null) {
if (null === $locale) {
$locale = $this->getLocale();
} else {
$this->assertValidLocale($locale);
}
//Get the translations
$translations = $this->getTranslation($l... | php | {
"resource": ""
} |
q261017 | Translator.getTranslation | test | public function getTranslation($locale) {
if (!isset($this->translations[$locale])) {
$this->translations[$locale] = $this->getFileTranslations($locale, $this->translatePath);
}
return $this->translations[$locale];
} | php | {
"resource": ""
} |
q261018 | Translator.getFileTranslations | test | protected function getFileTranslations($locale, $translatePath) {
$fileToInclude = $translatePath.$locale.'.php';
if (file_exists($fileToInclude)) {
/** @noinspection PhpIncludeInspection */
require $fileToInclude;
return $translation;
} else {
th... | php | {
"resource": ""
} |
q261019 | Translator.getTranslationForId | test | protected function getTranslationForId($id, $translationArray, $number = 0) {
$translation = '';
if(isset($translationArray[$id])) { //Id all join
$translation = $this->getBasicTranslationForId($translationArray[$id], $number);
} else { //Id separataly
$arrayOfIds = explo... | php | {
"resource": ""
} |
q261020 | Translator.getBasicTranslationForId | test | private function getBasicTranslationForId($translationId, $number) {
if(is_array($translationId) //Is array and we get the translate given for number array
&& isset($translationId[$number])
&& is_string($translationId[$number])) {
$translation = $translationId[$number];
... | php | {
"resource": ""
} |
q261021 | BuildMetaModelOperationsListener.generateToggleCommand | test | protected function generateToggleCommand($commands, $attribute, $commandName, $class, $language)
{
if (!$commands->hasCommandNamed($commandName)) {
$toggle = new TranslatedToggleCommand();
$toggle
->setLanguage($language)
->setToggleProperty($attribute... | php | {
"resource": ""
} |
q261022 | BuildMetaModelOperationsListener.buildCommandsFor | test | protected function buildCommandsFor($attribute, $commands)
{
$activeLanguage = $attribute->getMetaModel()->getActiveLanguage();
$commandName = 'publishtranslatedcheckboxtoggle_' . $attribute->getColName();
$this->generateToggleCommand(
$commands,
$attribute,
... | php | {
"resource": ""
} |
q261023 | BuildMetaModelOperationsListener.handle | test | public function handle(BuildMetaModelOperationsEvent $event)
{
foreach ($event->getMetaModel()->getAttributes() as $attribute) {
if (($attribute instanceof TranslatedCheckbox) && ($attribute->get('check_publish') == 1)) {
$container = $event->getContainer();
if ($... | php | {
"resource": ""
} |
q261024 | FrontController.main | test | public function main() {
$this->config->set('URLBase', $this->autoload->getURLBase());
$this->setAndAppLibraries(); //Load All library paths, not include in try because ErrorController is not present.
$this->loadAppFilesystem(); //Include the app filesystem structure into the loader path.
... | php | {
"resource": ""
} |
q261025 | FrontController.prepareAndCreateControllerAction | test | protected function prepareAndCreateControllerAction() {
//Create the view controller
$this->view = $this->getLibraryInstance('mvc', 'viewClass', $this->config);
//Create the controller with the core.
$controller = $this->createCoreAndController(
$this->routingRule->getCo... | php | {
"resource": ""
} |
q261026 | FrontController.executeACL | test | protected function executeACL() {
//Create the ACL
$this->acl = $this->getLibraryInstance('acl', 'aclClass', $this->auth, $this->connection, $this->language);
$isAllowed = $this->acl->isAllowed($this->routingRule);
//Check if is allow to create the controller and call the action
... | php | {
"resource": ""
} |
q261027 | FrontController.executeAuth | test | protected function executeAuth() {
//Create Auth controller
$this->auth = $this->getLibraryInstance('auth', 'authClass', $this->session, $this->routingRule->getInput(), $this->connection, $this->config, $this->language);
} | php | {
"resource": ""
} |
q261028 | FrontController.executeResolveRoute | test | protected function executeResolveRoute() {
//Add bulk routes
$routingIniFile = $this->autoload->getURLBase() . $this->config->get('routing')['bulkRoutePath'];
$this->routingResolver->addBulkRoutes($routingIniFile);
//Resolve route
$this->routingRule = $this->routingResolver->res... | php | {
"resource": ""
} |
q261029 | FrontController.setAndAppLibraries | test | private function setAndAppLibraries() {
//Get the libraries and application libraries
$this->appLibraries = $this->config->get('app')['paths'];
//Get the Structure
$this->Structure = $this->config->get('Structure')['filesystem'];
//Set to Autoloader the internal Structure
... | php | {
"resource": ""
} |
q261030 | FrontController.getLibraryInstance | test | private function getLibraryInstance($libraryName, $libraryClass) {
$instance = null;
$libraryClassName = $this->config->get($libraryName)[$libraryClass];
if (class_exists($libraryClassName)) {
if (count(func_get_args()) > 2) {
$arguments = array_slice(... | php | {
"resource": ""
} |
q261031 | FrontController.createCoreAndController | test | public function createCoreAndController(
$class,
\Mmf\Event\EventManagerInterface $eventManager,
\Mmf\IO\RequestInterface $request,
\Mmf\IO\ResponseInterface $response,
\Mmf\View\BasicViewInterface $view,
\Mmf\Language\LanguageInterface $language,
\Mmf\Routing\Rou... | php | {
"resource": ""
} |
q261032 | FrontController.callClassAndMethodWithInputArguments | test | public function callClassAndMethodWithInputArguments(
$class,
$method,
\Mmf\IO\RequestInterface $request
) {
$params = $this->getFunctionArguments($class, $method);
$listOfParams = [];
foreach ($params as $param) {
$paramValue = $request->input($param['na... | php | {
"resource": ""
} |
q261033 | FrontController.getFunctionArguments | test | public function getFunctionArguments($class, $method) {
$ReflectionMethod = new \ReflectionMethod($class, $method);
$paramsArray = array();
foreach ($ReflectionMethod->getParameters() as $param) {
$auxParam = array('name' => $param->getName(), 'isOptional' => false, 'initialValue' ... | php | {
"resource": ""
} |
q261034 | AuthModel.getRoleAndUserFromToken | test | public function getRoleAndUserFromToken($token) {
$sql = 'SELECT
user.username,
user.id_user,
role.name,
role.id_role,
role.id_parent,
NOW() AS db_date,
token.expire
... | php | {
"resource": ""
} |
q261035 | AuthModel.getRoleAndUserFromIdUser | test | public function getRoleAndUserFromIdUser($userId) {
$sql = 'SELECT
user.username,
user.id_user,
role.name,
role.id_role,
role.id_parent,
NOW() AS db_date
FROM
... | php | {
"resource": ""
} |
q261036 | Combo.getCurrentOptions | test | protected function getCurrentOptions()
{
$value = Html::getAttributeValue($this->model, $this->attribute);
if (!isset($value) || empty($value)) {
return [];
}
if (!empty($this->current)) {
return $this->current;
}
if ($this->getHasId()) {
... | php | {
"resource": ""
} |
q261037 | RequestHtml.setBulkOfInputGivenArray | test | protected function setBulkOfInputGivenArray($arrayOfParameters) {
if(is_array($arrayOfParameters)) {
foreach ($arrayOfParameters as $nameOfParameter => $valueOfParameter) {
$this->setInput($nameOfParameter, $valueOfParameter);
}
}
} | php | {
"resource": ""
} |
q261038 | RequestHtml.input | test | public function input($varName) {
if (isset($this->parameters[$varName])) {
return $this->filterVar($this->parameters[$varName]);
} else {
return null;
}
} | php | {
"resource": ""
} |
q261039 | RequestHtml.filterVar | test | public function filterVar($var) {
$response = NULL;
if (is_bool($var)) {
$response = $var;
} elseif(is_int($var)) {
$response = $var;
} elseif(is_float($var)) {
$response = $var;
}
if($var != 'null') {
if(is_string($var)) {
... | php | {
"resource": ""
} |
q261040 | PDO.openConnection | test | public function openConnection($name='db_default') {
foreach ($this->connections as $connection) {
if($connection['name'] == $name) {
return $connection['lynk'];
}
}
//Open new connection
try {
//Get the configuration of the connection.... | php | {
"resource": ""
} |
q261041 | PDO.closeConnection | test | public function closeConnection($name='db_default') {
foreach ($this->connections as $key => $connection) {
if($connection['name'] == $name) {
$this->connections[$key]['lynk'] = null; //closing the connection
array_splice($this->connections, $key, 1);
... | php | {
"resource": ""
} |
q261042 | MySQLModelAbstract.executeSQL | test | private function executeSQL($SQL, $parameters = null) {
try {
$queryPrepare = $this->connection->prepare($SQL);
if (is_array($parameters)) {
$queryPrepare->execute($parameters);
} else {
$queryPrepare->execute();
}
} catch (... | php | {
"resource": ""
} |
q261043 | MySQLModelAbstract.select | test | public function select($SQL, $parameters = null) {
$queryResult = $this->executeSQL($SQL, $parameters);
return $queryResult->fetchAll(\PDO::FETCH_ASSOC);
} | php | {
"resource": ""
} |
q261044 | MySQLModelAbstract.insert | test | public function insert($SQL, $parameters = null) {
$this->executeSQL($SQL, $parameters);
return $this->connection->lastInsertId();
} | php | {
"resource": ""
} |
q261045 | MySQLModelAbstract.delete | test | public function delete($SQL, $parameters = null) {
$queryResult = $this->executeSQL($SQL, $parameters);
return $queryResult->rowCount();
} | php | {
"resource": ""
} |
q261046 | MySQLModelAbstract.update | test | public function update($SQL, $parameters = null) {
$queryResult = $this->executeSQL($SQL, $parameters);
return $queryResult->rowCount();
} | php | {
"resource": ""
} |
q261047 | Auth.logout | test | public function logout() {
$this->setUserId($this->guestUserId);
$this->setUsername($this->guestUsername);
$this->setRoleId($this->guestRoleId);
$this->setRoleName($this->guestRoleName);
} | php | {
"resource": ""
} |
q261048 | Auth.setUserId | test | public function setUserId($userId) {
$this->userId = $userId;
if ($this->session !== null) {
$this->session->set('userId', $userId);
}
} | php | {
"resource": ""
} |
q261049 | Auth.setUsername | test | public function setUsername($username) {
$this->username = $username;
if ($this->session !== null) {
$this->session->set('username', $username);
}
} | php | {
"resource": ""
} |
q261050 | Auth.setRoleId | test | public function setRoleId($roleId) {
$this->roleId = $roleId;
if ($this->session !== null) {
$this->session->set('roleId', $roleId);
}
} | php | {
"resource": ""
} |
q261051 | Auth.setRoleName | test | public function setRoleName($roleName) {
$this->roleName = $roleName;
if ($this->session !== null) {
$this->session->set('roleName', $roleName);
}
} | php | {
"resource": ""
} |
q261052 | GenericValidator.validate | test | public function validate($value, Constraint $constraint)
{
$method = $constraint->method;
if (!$this->getManager()->$method($value, $constraint)) {
$this->setMessage($constraint->message, array(
'%property%' => $constraint->property
));
return fals... | php | {
"resource": ""
} |
q261053 | FileSystemPluginLocator.getInstalledPlugins | test | public function getInstalledPlugins($path) {
$searchPluginDirectories = $this->searchPluginDirectories($path);
$validPluginDirectories = array();
$factoryPluginClasses = array();
foreach ($searchPluginDirectories as $pluginDirectory) {
if (is_file($pluginDirectory. '/enab... | php | {
"resource": ""
} |
q261054 | FileSystemPluginLocator.searchPluginDirectories | test | protected function searchPluginDirectories($path) {
$pluginDirectories = array();
if ( ($directoryHandle = opendir($path)) == true ) {
while (($fileOrDir = readdir( $directoryHandle )) !== false) {
if (is_dir($path. $fileOrDir ) && $fileOrDir !== '.' && $fileOrDir !=='..') {
... | php | {
"resource": ""
} |
q261055 | FileSystemPluginLocator.searchPluginFactoryClass | test | protected function searchPluginFactoryClass($pluginDirectory) {
foreach ($this->internalPluginStructure as $pluginStructure) {
$path = $pluginDirectory.'/'.$pluginStructure.'/';
if ( ($directoryHandle = opendir($path)) == true ) {
while (($fileOrDir = readdir( $directoryH... | php | {
"resource": ""
} |
q261056 | FileSystemPluginLocator.haveTheFileImplementationOf | test | public function haveTheFileImplementationOf($file, $implementation = 'PluginInterface') {
$matches = array();
$fp = fopen($file, 'r');
while (!feof($fp)) {
$line = stream_get_line($fp, 1000000, "\n");
if (preg_match('/class\s+(\w+)(.*)\simplements\s+(\w+)(.*)?\{/', $line,... | php | {
"resource": ""
} |
q261057 | FunctionReflection.toString | test | public static function toString(Closure $closure)
{
$functionStringValue = '';
$functionReflection = new ReflectionFunction($closure);
$file = file($functionReflection->getFileName());
$lastLine = ($functionReflection->getEndLine() - 1);
for ($codeline = $functionReflectio... | php | {
"resource": ""
} |
q261058 | Operation.execute | test | public function execute(Closure $closure)
{
$temporaryFile = tempnam(sys_get_temp_dir(), 'covert');
$temporaryContent = '<?php'.PHP_EOL.PHP_EOL;
if ($this->autoload !== false) {
$temporaryContent .= "require('$this->autoload');".PHP_EOL.PHP_EOL;
}
$temporaryCon... | php | {
"resource": ""
} |
q261059 | Operation.executeFile | test | private function executeFile($file)
{
if (OperatingSystem::isWindows()) {
return $this->runCommandForWindows($file);
}
return $this->runCommandForNix($file);
} | php | {
"resource": ""
} |
q261060 | Operation.runCommandForWindows | test | private function runCommandForWindows($file)
{
if ($this->logging) {
$stdoutPipe = ['file', $this->logging, 'w'];
$stderrPipe = ['file', $this->logging, 'w'];
} else {
$stdoutPipe = fopen('NUL', 'c');
$stderrPipe = fopen('NUL', 'c');
}
... | php | {
"resource": ""
} |
q261061 | Operation.setAutoloadFile | test | public function setAutoloadFile($autoload)
{
if ($autoload !== false && !file_exists($autoload)) {
throw new Exception("The autoload path '{$autoload}' doesn't exist.");
}
$this->autoload = $autoload;
return $this;
} | php | {
"resource": ""
} |
q261062 | Operation.isRunning | test | public function isRunning()
{
$processId = $this->getProcessId();
if (OperatingSystem::isWindows()) {
$pids = shell_exec("wmic process get processid | find \"{$processId}\"");
$resource = array_filter(explode(' ', $pids));
$isRunning = count($resource) > 0 && $p... | php | {
"resource": ""
} |
q261063 | Operation.kill | test | public function kill()
{
if ($this->isRunning()) {
$processId = $this->getProcessId();
if (OperatingSystem::isWindows()) {
$cmd = "taskkill /pid {$processId} -t -f";
} else {
$cmd = "kill -9 {$processId}";
}
shell_... | php | {
"resource": ""
} |
q261064 | ProfilerBase.reset | test | protected function reset()
{
$this->log_sections = [];
$this->max_memory_usage = null;
$this->start_time = null;
$this->end_time = null;
} | php | {
"resource": ""
} |
q261065 | Uri.createFromString | test | public static function createFromString(string $str): self
{
$parsedUrl = parse_url($str);
return new self($parsedUrl['scheme'] ?? '',
$parsedUrl['host'] ?? null,
$parsedUrl['port'] ?? null,
$parsedUrl['path'] ?? '/',
... | php | {
"resource": ""
} |
q261066 | image.getDriver | test | final static function getDriver(array $drivers=array('gd')) {
foreach ($drivers as $driver) {
if (!preg_match('/^[a-z0-9\_]+$/i', $driver))
continue;
$class = __NAMESPACE__ . "\\image_$driver";
if (class_exists($class) && method_exists($class, "available")) {
... | php | {
"resource": ""
} |
q261067 | image.buildImage | test | final protected function buildImage($image) {
$class = get_class($this);
if ($image instanceof $class) {
$width = $image->width;
$height = $image->height;
$img = $image->image;
} elseif (is_array($image)) {
list($key, $width) = each($image);
... | php | {
"resource": ""
} |
q261068 | image.getPropWidth | test | final public function getPropWidth($resizedHeight) {
$width = round(($this->width * $resizedHeight) / $this->height);
if (!$width) $width = 1;
return $width;
} | php | {
"resource": ""
} |
q261069 | image.getPropHeight | test | final public function getPropHeight($resizedWidth) {
$height = round(($this->height * $resizedWidth) / $this->width);
if (!$height) $height = 1;
return $height;
} | php | {
"resource": ""
} |
q261070 | ByteSize.formatBinary | test | public static function formatBinary($bytes, $precision = null)
{
static $formatter = null;
if (!$formatter) {
$formatter = new Formatter\Binary();
}
return $formatter->format($bytes, $precision);
} | php | {
"resource": ""
} |
q261071 | ByteSize.formatMetric | test | public static function formatMetric($bytes, $precision = null)
{
static $formatter = null;
if (!$formatter) {
$formatter = new Formatter\Metric();
}
return $formatter->format($bytes, $precision);
} | php | {
"resource": ""
} |
q261072 | Session.create | test | public static function create($driverClass = self::DRIVER_SERVER, array $options = [])
{
$session = new Session($driverClass, $options);
return $session->initialize();
} | php | {
"resource": ""
} |
q261073 | Session.initialize | test | public function initialize()
{
$this->checkClassExistence();
$this->checkClassType();
$className = $this->driverClass;
return new $className($this->options);
} | php | {
"resource": ""
} |
q261074 | UrlEncodedParser.parse | test | public function parse()
{
$this->stream->rewind();
parse_str($this->stream->getContents(), $parsed);
return array_merge($_POST, $parsed);
} | php | {
"resource": ""
} |
q261075 | RequestUriFactory.generateUrl | test | private function generateUrl()
{
$hostHeader = $this->request->getHeaderLine('host');
$defaultHost = strlen($hostHeader) > 0 ? $hostHeader : 'unknown-host';
$host = $this->getServerParam('SERVER_NAME', $defaultHost);
$scheme = $this->getServerParam('REQUEST_SCHEME', 'http');
... | php | {
"resource": ""
} |
q261076 | RequestUriFactory.getServerParam | test | private function getServerParam($name, $default = null)
{
$data = $this->request->getServerParams();
if (array_key_exists($name, $data)) {
$default = trim($data[$name]);
}
return $default;
} | php | {
"resource": ""
} |
q261077 | Application.getDefaultInputDefinition | test | protected function getDefaultInputDefinition()
{
return new InputDefinition(
[
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
new InputOption(
'--env',
'-e',
InputOption:... | php | {
"resource": ""
} |
q261078 | Application.registerCommands | test | protected function registerCommands()
{
$this->addCommands(
[
new Command\MagicCommand,
new Command\RunCommand,
new Command\TestCommand,
new Command\Db\CreateCommand,
new Command\Db\MigrateCommand,
ne... | php | {
"resource": ""
} |
q261079 | Application.getModelPath | test | public function getModelPath($name) : string
{
return $this->getWorkingPath() . DIRECTORY_SEPARATOR
. 'application' . DIRECTORY_SEPARATOR
. 'models' . DIRECTORY_SEPARATOR
. ucfirst(strtolower($name));
} | php | {
"resource": ""
} |
q261080 | AbstractGenerateCommand.addForceOption | test | protected function addForceOption() : void
{
$force = new InputOption('--force', '-f', InputOption::VALUE_NONE, 'Rewrite previously generated files');
$this->getDefinition()->addOption($force);
} | php | {
"resource": ""
} |
q261081 | AbstractGenerateCommand.addModelArgument | test | protected function addModelArgument() : void
{
$model = new InputArgument('model', InputArgument::REQUIRED, 'Model name is required');
$this->getDefinition()->addArgument($model);
} | php | {
"resource": ""
} |
q261082 | AbstractGenerateCommand.validateModelArgument | test | protected function validateModelArgument() : void
{
$model = $this->getInput()->getArgument('model');
$validator = Validator::create()
->string()
->alphaNumeric()
->noWhitespace();
if ($this->getDefinition()->getArgument('model')->isRequired()
... | php | {
"resource": ""
} |
q261083 | AbstractGenerateCommand.addTableArgument | test | protected function addTableArgument() : void
{
$table = new InputArgument('table', InputArgument::REQUIRED, 'Table name is required');
$this->getDefinition()->addArgument($table);
} | php | {
"resource": ""
} |
q261084 | AbstractGenerateCommand.validateTableArgument | test | protected function validateTableArgument() : void
{
$table = $this->getInput()->getArgument('table');
$validator = Validator::create()
->string()
->alphaNumeric('_')
->noWhitespace();
if ($this->getDefinition()->getArgument('table')->isRequired()
... | php | {
"resource": ""
} |
q261085 | AbstractGenerateCommand.getTableInstance | test | protected function getTableInstance($model) : Table
{
$file = $this->getApplication()->getModelPath($model) . DS . 'Table.php';
if (!file_exists($file)) {
throw new GeneratorException(
"Model $model is not exist, run command `bluzman generate:model $model` before"
... | php | {
"resource": ""
} |
q261086 | AbstractGenerateCommand.generateFile | test | protected function generateFile($class, $file, array $data = []) : void
{
if (file_exists($file) && !$this->getInput()->getOption('force')) {
$this->comment(" |> File <info>$file</info> already exists");
return;
}
$template = $this->getTemplate($class);
$temp... | php | {
"resource": ""
} |
q261087 | RequestHandler.handle | test | public function handle(ServerRequestInterface $request): ResponseInterface
{
$response = call_user_func($this->callback, $request);
return $response;
} | php | {
"resource": ""
} |
q261088 | AbstractStream.isSeekable | test | public function isSeekable()
{
$seekable = false;
if ($this->stream) {
$meta = stream_get_meta_data($this->stream);
$seekable = $meta['seekable'];
}
return $seekable;
} | php | {
"resource": ""
} |
q261089 | BodyParser.createParserWith | test | private function createParserWith(StreamInterface $body)
{
$class = NullParser::class;
foreach (self::$parsers as $parser => $contentTypes) {
foreach ($contentTypes as $contentType) {
if (stripos($this->contentType, $contentType) !== false) {
$class = ... | php | {
"resource": ""
} |
q261090 | BodyParser.addParser | test | public static function addParser($className, array $contentTypes)
{
if (! is_a($className, BodyParserInterface::class)) {
throw new InvalidArgumentException(
"Parser objects MUST implement the BodyParserInterface interface."
);
}
$existing = isset(sel... | php | {
"resource": ""
} |
q261091 | AbstractCommand.addModuleArgument | test | protected function addModuleArgument($required = InputArgument::REQUIRED) : void
{
$module = new InputArgument('module', $required, 'Module name is required');
$this->getDefinition()->addArgument($module);
} | php | {
"resource": ""
} |
q261092 | AbstractCommand.addControllerArgument | test | protected function addControllerArgument($required = InputArgument::REQUIRED) : void
{
$controller = new InputArgument('controller', $required, 'Controller name is required');
$this->getDefinition()->addArgument($controller);
} | php | {
"resource": ""
} |
q261093 | HttpFactory.createRequest | test | public function createRequest(string $method,
$uri,
array $headers = [],
$body = null,
$protocolVersion = '1.1'): RequestInterface
{
$request = new Request($method, $this->... | php | {
"resource": ""
} |
q261094 | HttpFactory.createServerRequest | test | public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
{
if (is_string($uri)) {
$uri = Uri::createFromString($uri);
}
return new ServerRequest($method, $uri, [], [], $serverParams, new Stream());
} | php | {
"resource": ""
} |
q261095 | HttpFactory.createStream | test | public function createStream(string $content = ''): StreamInterface
{
$stream = new Stream();
$stream->write($content);
return $stream;
} | php | {
"resource": ""
} |
q261096 | HttpFactory.createStreamFromFile | test | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
if (!in_array($mode, ['r', 'r+', 'w+', 'a+', 'c+'])) {
throw new \InvalidArgumentException(sprintf('Invalid mode "%s" to read file "%s"', $mode));
}
if (($resource = @fopen($filename, $... | php | {
"resource": ""
} |
q261097 | HttpFactory.createUploadedFile | test | public function createUploadedFile(
StreamInterface $stream,
int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null,
string $filename = ''
): UploadedFileInterface {
if (is_null($size)) {
$size ... | php | {
"resource": ""
} |
q261098 | HttpFactory.createUri | test | public function createUri(string $uri = ''): UriInterface
{
if (is_string($uri)) {
return Uri::createFromString($uri);
} else {
throw new \InvalidArgumentException('Not valid URI given');
}
} | php | {
"resource": ""
} |
q261099 | AbstractFormatter.format | test | public function format($bytes, $precision = null)
{
$bytes = $this->normalizeBytes($bytes);
$out = $bytes . 'B';
foreach ($this->suffixes as $power => $suffix) {
if (bccomp($calc = $this->divPow($bytes, $this->base, $power), 1) >= 0) {
$out = $this->formatNumber(... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.