id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
sequence
docstring
stringlengths
3
47.2k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
91
247
8,100
phox-pro/pulsar-core
src/app/Logic/Config.php
Config.value
public function value(string $category_key, string $config_key) { if (!($category = ConfigCategory::where('key', $category_key)->first())) { throw new \Exception("Category with name ($category_key) not found"); } if (!($config = $category->configs()->where('key', $config_key)->first())) { throw new \Exception("Config with name ($config_key) not found"); } return $config->value; }
php
public function value(string $category_key, string $config_key) { if (!($category = ConfigCategory::where('key', $category_key)->first())) { throw new \Exception("Category with name ($category_key) not found"); } if (!($config = $category->configs()->where('key', $config_key)->first())) { throw new \Exception("Config with name ($config_key) not found"); } return $config->value; }
[ "public", "function", "value", "(", "string", "$", "category_key", ",", "string", "$", "config_key", ")", "{", "if", "(", "!", "(", "$", "category", "=", "ConfigCategory", "::", "where", "(", "'key'", ",", "$", "category_key", ")", "->", "first", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Category with name ($category_key) not found\"", ")", ";", "}", "if", "(", "!", "(", "$", "config", "=", "$", "category", "->", "configs", "(", ")", "->", "where", "(", "'key'", ",", "$", "config_key", ")", "->", "first", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Config with name ($config_key) not found\"", ")", ";", "}", "return", "$", "config", "->", "value", ";", "}" ]
Function for get configuration value @param string $category_key @param string $config_key @return string
[ "Function", "for", "get", "configuration", "value" ]
fa9c66f6578180253a65c91edf422fc3c51b32ba
https://github.com/phox-pro/pulsar-core/blob/fa9c66f6578180253a65c91edf422fc3c51b32ba/src/app/Logic/Config.php#L17-L26
8,101
phox-pro/pulsar-core
src/app/Logic/Config.php
Config.set
public function set(string $category_key, string $config_key, string $value) { $config = ConfigCategory::where('key', $category_key) ->first() ->configs() ->where('key', $config_key) ->first(); $config->value = $value; return $config->save(); }
php
public function set(string $category_key, string $config_key, string $value) { $config = ConfigCategory::where('key', $category_key) ->first() ->configs() ->where('key', $config_key) ->first(); $config->value = $value; return $config->save(); }
[ "public", "function", "set", "(", "string", "$", "category_key", ",", "string", "$", "config_key", ",", "string", "$", "value", ")", "{", "$", "config", "=", "ConfigCategory", "::", "where", "(", "'key'", ",", "$", "category_key", ")", "->", "first", "(", ")", "->", "configs", "(", ")", "->", "where", "(", "'key'", ",", "$", "config_key", ")", "->", "first", "(", ")", ";", "$", "config", "->", "value", "=", "$", "value", ";", "return", "$", "config", "->", "save", "(", ")", ";", "}" ]
Function for set configuration value. @param string $category_key @param string $config_key @param string $value @return void
[ "Function", "for", "set", "configuration", "value", "." ]
fa9c66f6578180253a65c91edf422fc3c51b32ba
https://github.com/phox-pro/pulsar-core/blob/fa9c66f6578180253a65c91edf422fc3c51b32ba/src/app/Logic/Config.php#L36-L45
8,102
phox-pro/pulsar-core
src/app/Logic/Config.php
Config.add
public function add(string $category_key, array $configuration) { $category = ConfigCategory::where('key', $category_key)->first(); if (!$category) { throw new \Exception("Category with name ($category_key) not found"); } foreach ($configuration as $config) { $this->checkConfiguration($config); $config = array_merge($config, ['config_category_id' => $category->id]); Model::create($config); } }
php
public function add(string $category_key, array $configuration) { $category = ConfigCategory::where('key', $category_key)->first(); if (!$category) { throw new \Exception("Category with name ($category_key) not found"); } foreach ($configuration as $config) { $this->checkConfiguration($config); $config = array_merge($config, ['config_category_id' => $category->id]); Model::create($config); } }
[ "public", "function", "add", "(", "string", "$", "category_key", ",", "array", "$", "configuration", ")", "{", "$", "category", "=", "ConfigCategory", "::", "where", "(", "'key'", ",", "$", "category_key", ")", "->", "first", "(", ")", ";", "if", "(", "!", "$", "category", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Category with name ($category_key) not found\"", ")", ";", "}", "foreach", "(", "$", "configuration", "as", "$", "config", ")", "{", "$", "this", "->", "checkConfiguration", "(", "$", "config", ")", ";", "$", "config", "=", "array_merge", "(", "$", "config", ",", "[", "'config_category_id'", "=>", "$", "category", "->", "id", "]", ")", ";", "Model", "::", "create", "(", "$", "config", ")", ";", "}", "}" ]
Function for add configuration to project @param string $category_key @param array $configuration @return void
[ "Function", "for", "add", "configuration", "to", "project" ]
fa9c66f6578180253a65c91edf422fc3c51b32ba
https://github.com/phox-pro/pulsar-core/blob/fa9c66f6578180253a65c91edf422fc3c51b32ba/src/app/Logic/Config.php#L54-L65
8,103
thecodingmachine/utils.i18n.fine
src/Mouf/Utils/I18n/Fine/Language/SessionLanguageDetection.php
SessionLanguageDetection.setLanguage
public function setLanguage($language) { if (!session_id()) { if ($this->sessionManager) { $this->sessionManager->start(); } } $_SESSION['_fine_I18n_language'] = $language; }
php
public function setLanguage($language) { if (!session_id()) { if ($this->sessionManager) { $this->sessionManager->start(); } } $_SESSION['_fine_I18n_language'] = $language; }
[ "public", "function", "setLanguage", "(", "$", "language", ")", "{", "if", "(", "!", "session_id", "(", ")", ")", "{", "if", "(", "$", "this", "->", "sessionManager", ")", "{", "$", "this", "->", "sessionManager", "->", "start", "(", ")", ";", "}", "}", "$", "_SESSION", "[", "'_fine_I18n_language'", "]", "=", "$", "language", ";", "}" ]
Sets the language to use. @param string $language
[ "Sets", "the", "language", "to", "use", "." ]
69c165497bc5c202892fdc8022591eddbb8e0e3b
https://github.com/thecodingmachine/utils.i18n.fine/blob/69c165497bc5c202892fdc8022591eddbb8e0e3b/src/Mouf/Utils/I18n/Fine/Language/SessionLanguageDetection.php#L59-L66
8,104
thinker-g/yii2-helpers
controllers/CrudController.php
CrudController.actionIndex
public function actionIndex() { $searchModel = Yii::createObject($this->getModelClass(static::KEY_SEARCH)); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render($this->viewID, [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); }
php
public function actionIndex() { $searchModel = Yii::createObject($this->getModelClass(static::KEY_SEARCH)); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render($this->viewID, [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); }
[ "public", "function", "actionIndex", "(", ")", "{", "$", "searchModel", "=", "Yii", "::", "createObject", "(", "$", "this", "->", "getModelClass", "(", "static", "::", "KEY_SEARCH", ")", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "Yii", "::", "$", "app", "->", "request", "->", "queryParams", ")", ";", "return", "$", "this", "->", "render", "(", "$", "this", "->", "viewID", ",", "[", "'searchModel'", "=>", "$", "searchModel", ",", "'dataProvider'", "=>", "$", "dataProvider", ",", "]", ")", ";", "}" ]
Lists all target models. @return string
[ "Lists", "all", "target", "models", "." ]
3362196e25e83bdf1f37b53f18f9613a43605f38
https://github.com/thinker-g/yii2-helpers/blob/3362196e25e83bdf1f37b53f18f9613a43605f38/controllers/CrudController.php#L36-L45
8,105
thinker-g/yii2-helpers
controllers/CrudController.php
CrudController.actionCreate
public function actionCreate() { $model = Yii::createObject($this->getModelClass()); if ($model->load(Yii::$app->request->post()) && $model->save()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success')); return $this->redirect(ArrayHelper::merge(['view'], $model->getPrimaryKey(true))); } else { if ($model->hasErrors()) { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->render($this->viewID, [ 'model' => $model, ]); } }
php
public function actionCreate() { $model = Yii::createObject($this->getModelClass()); if ($model->load(Yii::$app->request->post()) && $model->save()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success')); return $this->redirect(ArrayHelper::merge(['view'], $model->getPrimaryKey(true))); } else { if ($model->hasErrors()) { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->render($this->viewID, [ 'model' => $model, ]); } }
[ "public", "function", "actionCreate", "(", ")", "{", "$", "model", "=", "Yii", "::", "createObject", "(", "$", "this", "->", "getModelClass", "(", ")", ")", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", ",", "$", "this", "->", "getFlashMsg", "(", "'success'", ")", ")", ";", "return", "$", "this", "->", "redirect", "(", "ArrayHelper", "::", "merge", "(", "[", "'view'", "]", ",", "$", "model", "->", "getPrimaryKey", "(", "true", ")", ")", ")", ";", "}", "else", "{", "if", "(", "$", "model", "->", "hasErrors", "(", ")", ")", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'error'", ",", "$", "this", "->", "getFlashMsg", "(", "'error'", ")", ")", ";", "}", "return", "$", "this", "->", "render", "(", "$", "this", "->", "viewID", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}", "}" ]
Creates a new target model. If creation is successful, the browser will be redirected to the 'view' page. @return \yii\web\Response|string
[ "Creates", "a", "new", "target", "model", ".", "If", "creation", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
3362196e25e83bdf1f37b53f18f9613a43605f38
https://github.com/thinker-g/yii2-helpers/blob/3362196e25e83bdf1f37b53f18f9613a43605f38/controllers/CrudController.php#L63-L78
8,106
thinker-g/yii2-helpers
controllers/CrudController.php
CrudController.actionUpdate
public function actionUpdate() { $model = $this->findModel(); if ($model->load(Yii::$app->request->post()) && $model->save()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success')); return $this->redirect(ArrayHelper::merge(['view'], $model->getPrimaryKey(true))); } else { if ($model->hasErrors()) { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->render($this->viewID, [ 'model' => $model, ]); } }
php
public function actionUpdate() { $model = $this->findModel(); if ($model->load(Yii::$app->request->post()) && $model->save()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success')); return $this->redirect(ArrayHelper::merge(['view'], $model->getPrimaryKey(true))); } else { if ($model->hasErrors()) { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->render($this->viewID, [ 'model' => $model, ]); } }
[ "public", "function", "actionUpdate", "(", ")", "{", "$", "model", "=", "$", "this", "->", "findModel", "(", ")", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", ",", "$", "this", "->", "getFlashMsg", "(", "'success'", ")", ")", ";", "return", "$", "this", "->", "redirect", "(", "ArrayHelper", "::", "merge", "(", "[", "'view'", "]", ",", "$", "model", "->", "getPrimaryKey", "(", "true", ")", ")", ")", ";", "}", "else", "{", "if", "(", "$", "model", "->", "hasErrors", "(", ")", ")", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'error'", ",", "$", "this", "->", "getFlashMsg", "(", "'error'", ")", ")", ";", "}", "return", "$", "this", "->", "render", "(", "$", "this", "->", "viewID", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}", "}" ]
Updates an existing target model. If update is successful, the browser will be redirected to the 'view' page. @return \yii\web\Response|string
[ "Updates", "an", "existing", "target", "model", ".", "If", "update", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
3362196e25e83bdf1f37b53f18f9613a43605f38
https://github.com/thinker-g/yii2-helpers/blob/3362196e25e83bdf1f37b53f18f9613a43605f38/controllers/CrudController.php#L85-L100
8,107
thinker-g/yii2-helpers
controllers/CrudController.php
CrudController.actionDelete
public function actionDelete() { if ($this->findModel()->delete()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success'));; } else { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->redirect(['index']); }
php
public function actionDelete() { if ($this->findModel()->delete()) { \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success'));; } else { \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error')); } return $this->redirect(['index']); }
[ "public", "function", "actionDelete", "(", ")", "{", "if", "(", "$", "this", "->", "findModel", "(", ")", "->", "delete", "(", ")", ")", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'success'", ",", "$", "this", "->", "getFlashMsg", "(", "'success'", ")", ")", ";", ";", "}", "else", "{", "\\", "Yii", "::", "$", "app", "->", "getSession", "(", ")", "->", "setFlash", "(", "'error'", ",", "$", "this", "->", "getFlashMsg", "(", "'error'", ")", ")", ";", "}", "return", "$", "this", "->", "redirect", "(", "[", "'index'", "]", ")", ";", "}" ]
Deletes an existing target model. If deletion is successful, the browser will be redirected to the 'index' page. @return mixed
[ "Deletes", "an", "existing", "target", "model", ".", "If", "deletion", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "index", "page", "." ]
3362196e25e83bdf1f37b53f18f9613a43605f38
https://github.com/thinker-g/yii2-helpers/blob/3362196e25e83bdf1f37b53f18f9613a43605f38/controllers/CrudController.php#L107-L115
8,108
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.patchBackend
private function patchBackend($bundle) { $b = $this->validateBundle($bundle); $this->patchRouting($b); $this->generateCrud($b); }
php
private function patchBackend($bundle) { $b = $this->validateBundle($bundle); $this->patchRouting($b); $this->generateCrud($b); }
[ "private", "function", "patchBackend", "(", "$", "bundle", ")", "{", "$", "b", "=", "$", "this", "->", "validateBundle", "(", "$", "bundle", ")", ";", "$", "this", "->", "patchRouting", "(", "$", "b", ")", ";", "$", "this", "->", "generateCrud", "(", "$", "b", ")", ";", "}" ]
Add routing for backend @param string $bundle @return array
[ "Add", "routing", "for", "backend" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L64-L69
8,109
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateCrud
protected function generateCrud(AbstractResourceBundle $bundle) { $summary = array(); $this->generateMacrosView($bundle); if (in_array('index', $this->configuration['actions'])) { $this->generateIndexView($bundle, $summary); } if (in_array('show', $this->configuration['actions'])) { $this->generateShowView($bundle, $summary); } if (in_array('create', $this->configuration['actions'])) { $this->generateCreateView($bundle, $summary); } if (in_array('update', $this->configuration['actions'])) { $this->generateUpdateView($bundle, $summary); } $this->writeOutput($summary); }
php
protected function generateCrud(AbstractResourceBundle $bundle) { $summary = array(); $this->generateMacrosView($bundle); if (in_array('index', $this->configuration['actions'])) { $this->generateIndexView($bundle, $summary); } if (in_array('show', $this->configuration['actions'])) { $this->generateShowView($bundle, $summary); } if (in_array('create', $this->configuration['actions'])) { $this->generateCreateView($bundle, $summary); } if (in_array('update', $this->configuration['actions'])) { $this->generateUpdateView($bundle, $summary); } $this->writeOutput($summary); }
[ "protected", "function", "generateCrud", "(", "AbstractResourceBundle", "$", "bundle", ")", "{", "$", "summary", "=", "array", "(", ")", ";", "$", "this", "->", "generateMacrosView", "(", "$", "bundle", ")", ";", "if", "(", "in_array", "(", "'index'", ",", "$", "this", "->", "configuration", "[", "'actions'", "]", ")", ")", "{", "$", "this", "->", "generateIndexView", "(", "$", "bundle", ",", "$", "summary", ")", ";", "}", "if", "(", "in_array", "(", "'show'", ",", "$", "this", "->", "configuration", "[", "'actions'", "]", ")", ")", "{", "$", "this", "->", "generateShowView", "(", "$", "bundle", ",", "$", "summary", ")", ";", "}", "if", "(", "in_array", "(", "'create'", ",", "$", "this", "->", "configuration", "[", "'actions'", "]", ")", ")", "{", "$", "this", "->", "generateCreateView", "(", "$", "bundle", ",", "$", "summary", ")", ";", "}", "if", "(", "in_array", "(", "'update'", ",", "$", "this", "->", "configuration", "[", "'actions'", "]", ")", ")", "{", "$", "this", "->", "generateUpdateView", "(", "$", "bundle", ",", "$", "summary", ")", ";", "}", "$", "this", "->", "writeOutput", "(", "$", "summary", ")", ";", "}" ]
Generate CRUD views @param AbstractResourceBundle $bundle
[ "Generate", "CRUD", "views" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L177-L199
8,110
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateIndexView
protected function generateIndexView(AbstractResourceBundle $bundle, &$summary) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/index.html.twig'; if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Index view already exist.</>'; return; } $this->renderFile('crud/index.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'vars' => strtolower(Inflector::pluralize($this->model)), 'actions' => array( 'add' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_create') ) ) ); $summary[] = ''; $summary[] = '<bg=green>Index view created.</>'; }
php
protected function generateIndexView(AbstractResourceBundle $bundle, &$summary) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/index.html.twig'; if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Index view already exist.</>'; return; } $this->renderFile('crud/index.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'vars' => strtolower(Inflector::pluralize($this->model)), 'actions' => array( 'add' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_create') ) ) ); $summary[] = ''; $summary[] = '<bg=green>Index view created.</>'; }
[ "protected", "function", "generateIndexView", "(", "AbstractResourceBundle", "$", "bundle", ",", "&", "$", "summary", ")", "{", "$", "path", "=", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/index.html.twig'", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=red>Index view already exist.</>'", ";", "return", ";", "}", "$", "this", "->", "renderFile", "(", "'crud/index.html.twig.twig'", ",", "$", "path", ",", "array", "(", "'bundle'", "=>", "$", "bundle", "->", "getName", "(", ")", ",", "'model'", "=>", "$", "this", "->", "model", ",", "'prefix'", "=>", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ",", "'vars'", "=>", "strtolower", "(", "Inflector", "::", "pluralize", "(", "$", "this", "->", "model", ")", ")", ",", "'actions'", "=>", "array", "(", "'add'", "=>", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_create'", ")", ")", ")", ")", ";", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=green>Index view created.</>'", ";", "}" ]
Generate index view @param AbstractResourceBundle $bundle @param array $summary @return array
[ "Generate", "index", "view" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L209-L235
8,111
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateShowView
protected function generateShowView(AbstractResourceBundle $bundle, &$summary) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/show.html.twig'; $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $identifier = $this->getContainer()->get('doctrine') ->getManager() ->getClassMetadata($entityClass) ->getIdentifier(); if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Show view already exist.</>'; return; } $this->renderFile('crud/show.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'identifier' => $identifier[0], 'prefix' => $this->getBundlePrefix($bundle), 'cancel' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_index'), 'actions' => array( 'edit' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_update') ) ) ); $summary[] = ''; $summary[] = '<bg=green>Show view created.</>'; }
php
protected function generateShowView(AbstractResourceBundle $bundle, &$summary) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/show.html.twig'; $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $identifier = $this->getContainer()->get('doctrine') ->getManager() ->getClassMetadata($entityClass) ->getIdentifier(); if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Show view already exist.</>'; return; } $this->renderFile('crud/show.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'identifier' => $identifier[0], 'prefix' => $this->getBundlePrefix($bundle), 'cancel' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_index'), 'actions' => array( 'edit' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_update') ) ) ); $summary[] = ''; $summary[] = '<bg=green>Show view created.</>'; }
[ "protected", "function", "generateShowView", "(", "AbstractResourceBundle", "$", "bundle", ",", "&", "$", "summary", ")", "{", "$", "path", "=", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/show.html.twig'", ";", "$", "entityClass", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getAliasNamespace", "(", "$", "this", "->", "bundle", "->", "getName", "(", ")", ")", ".", "'\\\\'", ".", "$", "this", "->", "model", ";", "$", "identifier", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getManager", "(", ")", "->", "getClassMetadata", "(", "$", "entityClass", ")", "->", "getIdentifier", "(", ")", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=red>Show view already exist.</>'", ";", "return", ";", "}", "$", "this", "->", "renderFile", "(", "'crud/show.html.twig.twig'", ",", "$", "path", ",", "array", "(", "'bundle'", "=>", "$", "bundle", "->", "getName", "(", ")", ",", "'model'", "=>", "$", "this", "->", "model", ",", "'identifier'", "=>", "$", "identifier", "[", "0", "]", ",", "'prefix'", "=>", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ",", "'cancel'", "=>", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_index'", ")", ",", "'actions'", "=>", "array", "(", "'edit'", "=>", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_update'", ")", ")", ")", ")", ";", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=green>Show view created.</>'", ";", "}" ]
Generate show view @param AbstractResourceBundle $bundle
[ "Generate", "show", "view" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L242-L274
8,112
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateCreateView
protected function generateCreateView(AbstractResourceBundle $bundle, &$summary) { $this->generateFormView($bundle); $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/create.html.twig'; if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Create view already exist.</>'; return; } $this->renderFile('crud/create.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'action' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_create'), 'cancel' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_index'), ) ); $summary[] = ''; $summary[] = '<bg=green>Create view created.</>'; }
php
protected function generateCreateView(AbstractResourceBundle $bundle, &$summary) { $this->generateFormView($bundle); $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/create.html.twig'; if (file_exists($path)) { $summary[] = ''; $summary[] = '<bg=red>Create view already exist.</>'; return; } $this->renderFile('crud/create.html.twig.twig', $path, array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'action' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_create'), 'cancel' => strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_index'), ) ); $summary[] = ''; $summary[] = '<bg=green>Create view created.</>'; }
[ "protected", "function", "generateCreateView", "(", "AbstractResourceBundle", "$", "bundle", ",", "&", "$", "summary", ")", "{", "$", "this", "->", "generateFormView", "(", "$", "bundle", ")", ";", "$", "path", "=", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/create.html.twig'", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=red>Create view already exist.</>'", ";", "return", ";", "}", "$", "this", "->", "renderFile", "(", "'crud/create.html.twig.twig'", ",", "$", "path", ",", "array", "(", "'bundle'", "=>", "$", "bundle", "->", "getName", "(", ")", ",", "'model'", "=>", "$", "this", "->", "model", ",", "'prefix'", "=>", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ",", "'action'", "=>", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_create'", ")", ",", "'cancel'", "=>", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_index'", ")", ",", ")", ")", ";", "$", "summary", "[", "]", "=", "''", ";", "$", "summary", "[", "]", "=", "'<bg=green>Create view created.</>'", ";", "}" ]
Generate create view @param AbstractResourceBundle $bundle
[ "Generate", "create", "view" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L281-L306
8,113
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateMacrosView
protected function generateMacrosView(AbstractResourceBundle $bundle) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig'; if (!file_exists($path)) { $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $metadata = $this->getEntityMetadata($entityClass); $identifier = $this->getContainer()->get('doctrine') ->getManager() ->getClassMetadata($entityClass) ->getIdentifier(); $actions = array(); array_map(function($key) use ($bundle, &$actions) { if (in_array($key, array('show', 'update'))) { $actions[$key] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_' . $key); } }, $this->configuration['actions']); $actions['delete'] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_delete'); $this->renderFile('crud/macros.html.twig.twig', $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig', array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'vars' => strtolower(Inflector::pluralize($this->model)), 'identifier' => $identifier[0], 'fields' => $this->getFieldsFromMetadata($metadata[0]), 'actions' => $actions ) ); } }
php
protected function generateMacrosView(AbstractResourceBundle $bundle) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig'; if (!file_exists($path)) { $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $metadata = $this->getEntityMetadata($entityClass); $identifier = $this->getContainer()->get('doctrine') ->getManager() ->getClassMetadata($entityClass) ->getIdentifier(); $actions = array(); array_map(function($key) use ($bundle, &$actions) { if (in_array($key, array('show', 'update'))) { $actions[$key] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_' . $key); } }, $this->configuration['actions']); $actions['delete'] = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model . '_delete'); $this->renderFile('crud/macros.html.twig.twig', $bundle->getPath() . '/Resources/views/' . $this->model . '/macros.html.twig', array( 'bundle' => $bundle->getName(), 'model' => $this->model, 'prefix' => $this->getBundlePrefix($bundle), 'vars' => strtolower(Inflector::pluralize($this->model)), 'identifier' => $identifier[0], 'fields' => $this->getFieldsFromMetadata($metadata[0]), 'actions' => $actions ) ); } }
[ "protected", "function", "generateMacrosView", "(", "AbstractResourceBundle", "$", "bundle", ")", "{", "$", "path", "=", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/macros.html.twig'", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "$", "entityClass", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getAliasNamespace", "(", "$", "this", "->", "bundle", "->", "getName", "(", ")", ")", ".", "'\\\\'", ".", "$", "this", "->", "model", ";", "$", "metadata", "=", "$", "this", "->", "getEntityMetadata", "(", "$", "entityClass", ")", ";", "$", "identifier", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getManager", "(", ")", "->", "getClassMetadata", "(", "$", "entityClass", ")", "->", "getIdentifier", "(", ")", ";", "$", "actions", "=", "array", "(", ")", ";", "array_map", "(", "function", "(", "$", "key", ")", "use", "(", "$", "bundle", ",", "&", "$", "actions", ")", "{", "if", "(", "in_array", "(", "$", "key", ",", "array", "(", "'show'", ",", "'update'", ")", ")", ")", "{", "$", "actions", "[", "$", "key", "]", "=", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_'", ".", "$", "key", ")", ";", "}", "}", ",", "$", "this", "->", "configuration", "[", "'actions'", "]", ")", ";", "$", "actions", "[", "'delete'", "]", "=", "strtolower", "(", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ".", "'_'", ".", "$", "this", "->", "model", ".", "'_delete'", ")", ";", "$", "this", "->", "renderFile", "(", "'crud/macros.html.twig.twig'", ",", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/macros.html.twig'", ",", "array", "(", "'bundle'", "=>", "$", "bundle", "->", "getName", "(", ")", ",", "'model'", "=>", "$", "this", "->", "model", ",", "'prefix'", "=>", "$", "this", "->", "getBundlePrefix", "(", "$", "bundle", ")", ",", "'vars'", "=>", "strtolower", "(", "Inflector", "::", "pluralize", "(", "$", "this", "->", "model", ")", ")", ",", "'identifier'", "=>", "$", "identifier", "[", "0", "]", ",", "'fields'", "=>", "$", "this", "->", "getFieldsFromMetadata", "(", "$", "metadata", "[", "0", "]", ")", ",", "'actions'", "=>", "$", "actions", ")", ")", ";", "}", "}" ]
Generate macros view @param AbstractResourceBundle $bundle
[ "Generate", "macros", "view" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L351-L385
8,114
avoo/FrameworkGeneratorBundle
Generator/Template/Crud.php
Crud.generateFormView
protected function generateFormView(AbstractResourceBundle $bundle) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig'; if (!file_exists($path)) { $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $metadata = $this->getEntityMetadata($entityClass); $this->renderFile('crud/_form.html.twig.twig', $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig', array( 'fields' => $this->getFieldsFromMetadata($metadata[0]), ) ); } }
php
protected function generateFormView(AbstractResourceBundle $bundle) { $path = $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig'; if (!file_exists($path)) { $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $metadata = $this->getEntityMetadata($entityClass); $this->renderFile('crud/_form.html.twig.twig', $bundle->getPath() . '/Resources/views/' . $this->model . '/_form.html.twig', array( 'fields' => $this->getFieldsFromMetadata($metadata[0]), ) ); } }
[ "protected", "function", "generateFormView", "(", "AbstractResourceBundle", "$", "bundle", ")", "{", "$", "path", "=", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/_form.html.twig'", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "$", "entityClass", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getAliasNamespace", "(", "$", "this", "->", "bundle", "->", "getName", "(", ")", ")", ".", "'\\\\'", ".", "$", "this", "->", "model", ";", "$", "metadata", "=", "$", "this", "->", "getEntityMetadata", "(", "$", "entityClass", ")", ";", "$", "this", "->", "renderFile", "(", "'crud/_form.html.twig.twig'", ",", "$", "bundle", "->", "getPath", "(", ")", ".", "'/Resources/views/'", ".", "$", "this", "->", "model", ".", "'/_form.html.twig'", ",", "array", "(", "'fields'", "=>", "$", "this", "->", "getFieldsFromMetadata", "(", "$", "metadata", "[", "0", "]", ")", ",", ")", ")", ";", "}", "}" ]
Generate form view @param AbstractResourceBundle $bundle
[ "Generate", "form", "view" ]
3178268b9e58e6c60c27e0b9ea976944c1f61a48
https://github.com/avoo/FrameworkGeneratorBundle/blob/3178268b9e58e6c60c27e0b9ea976944c1f61a48/Generator/Template/Crud.php#L392-L407
8,115
rozaverta/cmf
core/View/Package.php
Package.includeFunc
public function includeFunc( View $view) { if( $this->isFunc() ) { Helper::includeFile( $this->getFuncFilePath(), ["view" => $view], false, true ); } return $this; }
php
public function includeFunc( View $view) { if( $this->isFunc() ) { Helper::includeFile( $this->getFuncFilePath(), ["view" => $view], false, true ); } return $this; }
[ "public", "function", "includeFunc", "(", "View", "$", "view", ")", "{", "if", "(", "$", "this", "->", "isFunc", "(", ")", ")", "{", "Helper", "::", "includeFile", "(", "$", "this", "->", "getFuncFilePath", "(", ")", ",", "[", "\"view\"", "=>", "$", "view", "]", ",", "false", ",", "true", ")", ";", "}", "return", "$", "this", ";", "}" ]
Include function file. @param View $view @return $this
[ "Include", "function", "file", "." ]
95ed38362e397d1c700ee255f7200234ef98d356
https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/View/Package.php#L215-L222
8,116
Dhii/container-helper-base
src/NormalizeWritableContainerCapableTrait.php
NormalizeWritableContainerCapableTrait._normalizeWritableContainer
protected function _normalizeWritableContainer($container) { $container = $this->_normalizeContainer($container); if ($container instanceof BaseContainerInterface) { throw $this->_createInvalidArgumentException( $this->__('Invalid container'), null, null, $container ); } return $container; }
php
protected function _normalizeWritableContainer($container) { $container = $this->_normalizeContainer($container); if ($container instanceof BaseContainerInterface) { throw $this->_createInvalidArgumentException( $this->__('Invalid container'), null, null, $container ); } return $container; }
[ "protected", "function", "_normalizeWritableContainer", "(", "$", "container", ")", "{", "$", "container", "=", "$", "this", "->", "_normalizeContainer", "(", "$", "container", ")", ";", "if", "(", "$", "container", "instanceof", "BaseContainerInterface", ")", "{", "throw", "$", "this", "->", "_createInvalidArgumentException", "(", "$", "this", "->", "__", "(", "'Invalid container'", ")", ",", "null", ",", "null", ",", "$", "container", ")", ";", "}", "return", "$", "container", ";", "}" ]
Normalizes a writable container. @since [*next-version*] @param array|ArrayAccess|stdClass $container The writable container to normalize. @throws InvalidArgumentException If not a valid writable container. @return array|ArrayAccess|stdClass A container that can be written to.
[ "Normalizes", "a", "writable", "container", "." ]
ccb2f56971d70cf203baa596cd14fdf91be6bfae
https://github.com/Dhii/container-helper-base/blob/ccb2f56971d70cf203baa596cd14fdf91be6bfae/src/NormalizeWritableContainerCapableTrait.php#L30-L44
8,117
vip9008/yii2-googleapisclient
auth/ComputeEngine.php
ComputeEngine.acquireAccessToken
public function acquireAccessToken() { $request = new Request( self::METADATA_AUTH_URL, 'GET', array( 'Metadata-Flavor' => 'Google' ) ); $request->disableGzip(); $response = $this->client->getIo()->makeRequest($request); if ($response->getResponseHttpCode() == 200) { $this->setAccessToken($response->getResponseBody()); $this->token['created'] = time(); return $this->getAccessToken(); } else { throw new Exception( sprintf( "Error fetching service account access token, message: '%s'", $response->getResponseBody() ), $response->getResponseHttpCode() ); } }
php
public function acquireAccessToken() { $request = new Request( self::METADATA_AUTH_URL, 'GET', array( 'Metadata-Flavor' => 'Google' ) ); $request->disableGzip(); $response = $this->client->getIo()->makeRequest($request); if ($response->getResponseHttpCode() == 200) { $this->setAccessToken($response->getResponseBody()); $this->token['created'] = time(); return $this->getAccessToken(); } else { throw new Exception( sprintf( "Error fetching service account access token, message: '%s'", $response->getResponseBody() ), $response->getResponseHttpCode() ); } }
[ "public", "function", "acquireAccessToken", "(", ")", "{", "$", "request", "=", "new", "Request", "(", "self", "::", "METADATA_AUTH_URL", ",", "'GET'", ",", "array", "(", "'Metadata-Flavor'", "=>", "'Google'", ")", ")", ";", "$", "request", "->", "disableGzip", "(", ")", ";", "$", "response", "=", "$", "this", "->", "client", "->", "getIo", "(", ")", "->", "makeRequest", "(", "$", "request", ")", ";", "if", "(", "$", "response", "->", "getResponseHttpCode", "(", ")", "==", "200", ")", "{", "$", "this", "->", "setAccessToken", "(", "$", "response", "->", "getResponseBody", "(", ")", ")", ";", "$", "this", "->", "token", "[", "'created'", "]", "=", "time", "(", ")", ";", "return", "$", "this", "->", "getAccessToken", "(", ")", ";", "}", "else", "{", "throw", "new", "Exception", "(", "sprintf", "(", "\"Error fetching service account access token, message: '%s'\"", ",", "$", "response", "->", "getResponseBody", "(", ")", ")", ",", "$", "response", "->", "getResponseHttpCode", "(", ")", ")", ";", "}", "}" ]
Acquires a new access token from the compute engine metadata server. @throws Exception
[ "Acquires", "a", "new", "access", "token", "from", "the", "compute", "engine", "metadata", "server", "." ]
b6aae1c490d84a6004ed7dccb5d4176184032b57
https://github.com/vip9008/yii2-googleapisclient/blob/b6aae1c490d84a6004ed7dccb5d4176184032b57/auth/ComputeEngine.php#L80-L105
8,118
chigix/chiji-frontend
src/Annotation/FunctionAnnotation.php
FunctionAnnotation.parse
public final function parse($param_str) { $params = explode(",", $param_str); foreach ($params as $param_item) { $param_kv = explode("=", $param_item); $param_key = trim($param_kv[0]); $param_value = trim($param_kv[1]); if ('"' === substr($param_key, 0, 1) && '"' === substr($param_key, -1, 1)) { $param_key = substr($param_key, 1, strlen($param_key) - 2); } if ('"' === substr($param_value, 0, 1) && '"' === substr($param_value, -1, 1)) { // This param_value is a string type, which could be set directly if (property_exists($this, $param_key)) { $this->$param_key = substr($param_value, 1, strlen($param_value) - 2); } else { // @TODO support special variables like from `@use` } } } }
php
public final function parse($param_str) { $params = explode(",", $param_str); foreach ($params as $param_item) { $param_kv = explode("=", $param_item); $param_key = trim($param_kv[0]); $param_value = trim($param_kv[1]); if ('"' === substr($param_key, 0, 1) && '"' === substr($param_key, -1, 1)) { $param_key = substr($param_key, 1, strlen($param_key) - 2); } if ('"' === substr($param_value, 0, 1) && '"' === substr($param_value, -1, 1)) { // This param_value is a string type, which could be set directly if (property_exists($this, $param_key)) { $this->$param_key = substr($param_value, 1, strlen($param_value) - 2); } else { // @TODO support special variables like from `@use` } } } }
[ "public", "final", "function", "parse", "(", "$", "param_str", ")", "{", "$", "params", "=", "explode", "(", "\",\"", ",", "$", "param_str", ")", ";", "foreach", "(", "$", "params", "as", "$", "param_item", ")", "{", "$", "param_kv", "=", "explode", "(", "\"=\"", ",", "$", "param_item", ")", ";", "$", "param_key", "=", "trim", "(", "$", "param_kv", "[", "0", "]", ")", ";", "$", "param_value", "=", "trim", "(", "$", "param_kv", "[", "1", "]", ")", ";", "if", "(", "'\"'", "===", "substr", "(", "$", "param_key", ",", "0", ",", "1", ")", "&&", "'\"'", "===", "substr", "(", "$", "param_key", ",", "-", "1", ",", "1", ")", ")", "{", "$", "param_key", "=", "substr", "(", "$", "param_key", ",", "1", ",", "strlen", "(", "$", "param_key", ")", "-", "2", ")", ";", "}", "if", "(", "'\"'", "===", "substr", "(", "$", "param_value", ",", "0", ",", "1", ")", "&&", "'\"'", "===", "substr", "(", "$", "param_value", ",", "-", "1", ",", "1", ")", ")", "{", "// This param_value is a string type, which could be set directly", "if", "(", "property_exists", "(", "$", "this", ",", "$", "param_key", ")", ")", "{", "$", "this", "->", "$", "param_key", "=", "substr", "(", "$", "param_value", ",", "1", ",", "strlen", "(", "$", "param_value", ")", "-", "2", ")", ";", "}", "else", "{", "// @TODO support special variables like from `@use`", "}", "}", "}", "}" ]
wait for the end of the compiling and then exec this function.
[ "wait", "for", "the", "end", "of", "the", "compiling", "and", "then", "exec", "this", "function", "." ]
5407f98c21ee99f8bbef43c97a231c0f81ed3e74
https://github.com/chigix/chiji-frontend/blob/5407f98c21ee99f8bbef43c97a231c0f81ed3e74/src/Annotation/FunctionAnnotation.php#L32-L50
8,119
webriq/core
module/Core/Module.php
Module.onDispatchError
public function onDispatchError( MvcEvent $event ) { /* @var $exception \Exception */ $exception = $event->getParam( 'exception' ); if ( $exception && $exception instanceof Exception ) { $this->exceptionHandler( $exception, false ); } if ( $this->response ) { $event->stopPropagation(); return $this->response; } }
php
public function onDispatchError( MvcEvent $event ) { /* @var $exception \Exception */ $exception = $event->getParam( 'exception' ); if ( $exception && $exception instanceof Exception ) { $this->exceptionHandler( $exception, false ); } if ( $this->response ) { $event->stopPropagation(); return $this->response; } }
[ "public", "function", "onDispatchError", "(", "MvcEvent", "$", "event", ")", "{", "/* @var $exception \\Exception */", "$", "exception", "=", "$", "event", "->", "getParam", "(", "'exception'", ")", ";", "if", "(", "$", "exception", "&&", "$", "exception", "instanceof", "Exception", ")", "{", "$", "this", "->", "exceptionHandler", "(", "$", "exception", ",", "false", ")", ";", "}", "if", "(", "$", "this", "->", "response", ")", "{", "$", "event", "->", "stopPropagation", "(", ")", ";", "return", "$", "this", "->", "response", ";", "}", "}" ]
Listen to the dispatch.error event @param \Zend\Mvc\MvcEvent $event
[ "Listen", "to", "the", "dispatch", ".", "error", "event" ]
cfeb6e8a4732561c2215ec94e736c07f9b8bc990
https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/Module.php#L230-L245
8,120
webriq/core
module/Core/Module.php
Module.onDispatch
public function onDispatch( MvcEvent $event ) { if ( $this->response ) { $event->stopPropagation(); return $this->response; } $routeMatch = $event->getRouteMatch(); $sm = $event->getApplication() ->getServiceManager(); // Set current timezone, when first get $sm->get( 'Timezone' ); if ( $routeMatch ) { $locale = $routeMatch->getParam( 'locale' ); } if ( ! $locale ) { $request = $event->getRequest(); if ( $request instanceof HttpRequest ) { $header = $request->getHeader( 'Accept-Language' ); if ( $header ) { $availables = null; $controller = $event->getController(); if ( $controller instanceof LocaleSelectorInterface ) { $availables = $controller->getAvailableLocales(); } $locale = $sm->get( 'Locale' ) ->acceptFromHttp( $header->getFieldValue(), $availables ); } } } if ( $locale ) { $sm->get( 'Locale' ) ->setCurrent( $locale ); } }
php
public function onDispatch( MvcEvent $event ) { if ( $this->response ) { $event->stopPropagation(); return $this->response; } $routeMatch = $event->getRouteMatch(); $sm = $event->getApplication() ->getServiceManager(); // Set current timezone, when first get $sm->get( 'Timezone' ); if ( $routeMatch ) { $locale = $routeMatch->getParam( 'locale' ); } if ( ! $locale ) { $request = $event->getRequest(); if ( $request instanceof HttpRequest ) { $header = $request->getHeader( 'Accept-Language' ); if ( $header ) { $availables = null; $controller = $event->getController(); if ( $controller instanceof LocaleSelectorInterface ) { $availables = $controller->getAvailableLocales(); } $locale = $sm->get( 'Locale' ) ->acceptFromHttp( $header->getFieldValue(), $availables ); } } } if ( $locale ) { $sm->get( 'Locale' ) ->setCurrent( $locale ); } }
[ "public", "function", "onDispatch", "(", "MvcEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "response", ")", "{", "$", "event", "->", "stopPropagation", "(", ")", ";", "return", "$", "this", "->", "response", ";", "}", "$", "routeMatch", "=", "$", "event", "->", "getRouteMatch", "(", ")", ";", "$", "sm", "=", "$", "event", "->", "getApplication", "(", ")", "->", "getServiceManager", "(", ")", ";", "// Set current timezone, when first get", "$", "sm", "->", "get", "(", "'Timezone'", ")", ";", "if", "(", "$", "routeMatch", ")", "{", "$", "locale", "=", "$", "routeMatch", "->", "getParam", "(", "'locale'", ")", ";", "}", "if", "(", "!", "$", "locale", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "$", "request", "instanceof", "HttpRequest", ")", "{", "$", "header", "=", "$", "request", "->", "getHeader", "(", "'Accept-Language'", ")", ";", "if", "(", "$", "header", ")", "{", "$", "availables", "=", "null", ";", "$", "controller", "=", "$", "event", "->", "getController", "(", ")", ";", "if", "(", "$", "controller", "instanceof", "LocaleSelectorInterface", ")", "{", "$", "availables", "=", "$", "controller", "->", "getAvailableLocales", "(", ")", ";", "}", "$", "locale", "=", "$", "sm", "->", "get", "(", "'Locale'", ")", "->", "acceptFromHttp", "(", "$", "header", "->", "getFieldValue", "(", ")", ",", "$", "availables", ")", ";", "}", "}", "}", "if", "(", "$", "locale", ")", "{", "$", "sm", "->", "get", "(", "'Locale'", ")", "->", "setCurrent", "(", "$", "locale", ")", ";", "}", "}" ]
General dispatch listener @param \Zend\Mvc\MvcEvent $event
[ "General", "dispatch", "listener" ]
cfeb6e8a4732561c2215ec94e736c07f9b8bc990
https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/Module.php#L252-L302
8,121
webriq/core
module/Core/Module.php
Module.getViewWidgetViewHelper
public function getViewWidgetViewHelper() { $config = $this->serviceLocator ->get( 'Config' ); return View\Helper\ViewWidget::factory( $this->serviceLocator, empty( $config['view_widgets'] ) ? array() : $config['view_widgets'] ); }
php
public function getViewWidgetViewHelper() { $config = $this->serviceLocator ->get( 'Config' ); return View\Helper\ViewWidget::factory( $this->serviceLocator, empty( $config['view_widgets'] ) ? array() : $config['view_widgets'] ); }
[ "public", "function", "getViewWidgetViewHelper", "(", ")", "{", "$", "config", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'Config'", ")", ";", "return", "View", "\\", "Helper", "\\", "ViewWidget", "::", "factory", "(", "$", "this", "->", "serviceLocator", ",", "empty", "(", "$", "config", "[", "'view_widgets'", "]", ")", "?", "array", "(", ")", ":", "$", "config", "[", "'view_widgets'", "]", ")", ";", "}" ]
Get `viewWidget` view-helper instance @return View\Helper\ViewWidget
[ "Get", "viewWidget", "view", "-", "helper", "instance" ]
cfeb6e8a4732561c2215ec94e736c07f9b8bc990
https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Core/Module.php#L443-L452
8,122
novuso/system
src/Collection/Iterator/ArrayQueueIterator.php
ArrayQueueIterator.current
public function current() { if (!$this->valid()) { return null; } $index = $this->index; $front = $this->front; $cap = $this->cap; $offset = ($index + $front) % $cap; return $this->items[$offset]; }
php
public function current() { if (!$this->valid()) { return null; } $index = $this->index; $front = $this->front; $cap = $this->cap; $offset = ($index + $front) % $cap; return $this->items[$offset]; }
[ "public", "function", "current", "(", ")", "{", "if", "(", "!", "$", "this", "->", "valid", "(", ")", ")", "{", "return", "null", ";", "}", "$", "index", "=", "$", "this", "->", "index", ";", "$", "front", "=", "$", "this", "->", "front", ";", "$", "cap", "=", "$", "this", "->", "cap", ";", "$", "offset", "=", "(", "$", "index", "+", "$", "front", ")", "%", "$", "cap", ";", "return", "$", "this", "->", "items", "[", "$", "offset", "]", ";", "}" ]
Retrieves the current item @return mixed
[ "Retrieves", "the", "current", "item" ]
e34038b391826edc68d0b5fccfba96642de9d6f0
https://github.com/novuso/system/blob/e34038b391826edc68d0b5fccfba96642de9d6f0/src/Collection/Iterator/ArrayQueueIterator.php#L106-L118
8,123
lasallecrm/lasallecrm-l5-listmanagement-pkg
src/SendEmails/SendEmailsFromList.php
SendEmailsFromList.sendEmails
public function sendEmails($listID, $data) { // if the list is not enabled, then return false if (!$this->helpers->isListEnabled($listID)) { return false; } $emailData = []; // subject $emailData['subject'] = $this->helpers->getListNameFromListID($listID) . ' - ' . $data['title']; // build the individual emails $emailIDs = $this->helpers->getEnabledEmailsFromList($listID); if (count($emailIDs) == 0) { // for some reason, maybe mismatched list_id #'s, finding no emails return false; } // link to the post $data['link'] = '<a href="'; $data['link'] .= $data['canonical_url']; $data['link'] .= '">'; $data['link'] .= $data['title']; $data['link'] .= '</a>'; // iterate through each email address, prepping and sending each email individually! foreach ($emailIDs as $emailID) { // if emails must be type "primary" AND the email is *not* type primary, do not process if (!$this->helpers->isEmailAddressPrimaryType($emailID->email_id)) { continue; } /////////////////////////////////////////////////////////////////////////////////////////// //// Unsubscribe from List //// /////////////////////////////////////////////////////////////////////////////////////////// // Create a token $unsubscribeToken = $this->createUnsubscribeToken->createUniqueToken(); // INSERT to the list_unsubscribe_token database table $this->createUnsubscribeToken->createTokenRecord($listID, $emailID->email_id, $unsubscribeToken); // Build the unsubscribe link $data['unsubscribe_link'] = $this->createUnsubscribeToken->unsubscribeURL($unsubscribeToken); /////////////////////////////////////////////////////////////////////////////////////////// //// Send email to a list recipient //// /////////////////////////////////////////////////////////////////////////////////////////// // get the actual email address from the "email_id" field in the "list_email" db table $emailData['to_email'] = $this->helpers->getEmailAddressFromEmailID($emailID->email_id); // get the person's first name and surname $emailData['to_name'] = $this->helpers->getFirstnameSurnameFromEmailID($emailID->email_id); $data['to_email'] = $emailData['to_email'] ; $data['to_name'] = $emailData['to_name']; // send the email one-at-a-time // note the queue-ing Mail::queue('lasallecrmlistmanagement::emails.send_email_from_list', ['data' => $data], function($message) use ($emailData) { $message->from(Config::get('lasallecmscontact.from_email'), Config::get('lasallecmscontact.from_name')); $message->to($emailData['to_email'], $emailData['to_name']); $message->subject($emailData['subject']); }); } return true; }
php
public function sendEmails($listID, $data) { // if the list is not enabled, then return false if (!$this->helpers->isListEnabled($listID)) { return false; } $emailData = []; // subject $emailData['subject'] = $this->helpers->getListNameFromListID($listID) . ' - ' . $data['title']; // build the individual emails $emailIDs = $this->helpers->getEnabledEmailsFromList($listID); if (count($emailIDs) == 0) { // for some reason, maybe mismatched list_id #'s, finding no emails return false; } // link to the post $data['link'] = '<a href="'; $data['link'] .= $data['canonical_url']; $data['link'] .= '">'; $data['link'] .= $data['title']; $data['link'] .= '</a>'; // iterate through each email address, prepping and sending each email individually! foreach ($emailIDs as $emailID) { // if emails must be type "primary" AND the email is *not* type primary, do not process if (!$this->helpers->isEmailAddressPrimaryType($emailID->email_id)) { continue; } /////////////////////////////////////////////////////////////////////////////////////////// //// Unsubscribe from List //// /////////////////////////////////////////////////////////////////////////////////////////// // Create a token $unsubscribeToken = $this->createUnsubscribeToken->createUniqueToken(); // INSERT to the list_unsubscribe_token database table $this->createUnsubscribeToken->createTokenRecord($listID, $emailID->email_id, $unsubscribeToken); // Build the unsubscribe link $data['unsubscribe_link'] = $this->createUnsubscribeToken->unsubscribeURL($unsubscribeToken); /////////////////////////////////////////////////////////////////////////////////////////// //// Send email to a list recipient //// /////////////////////////////////////////////////////////////////////////////////////////// // get the actual email address from the "email_id" field in the "list_email" db table $emailData['to_email'] = $this->helpers->getEmailAddressFromEmailID($emailID->email_id); // get the person's first name and surname $emailData['to_name'] = $this->helpers->getFirstnameSurnameFromEmailID($emailID->email_id); $data['to_email'] = $emailData['to_email'] ; $data['to_name'] = $emailData['to_name']; // send the email one-at-a-time // note the queue-ing Mail::queue('lasallecrmlistmanagement::emails.send_email_from_list', ['data' => $data], function($message) use ($emailData) { $message->from(Config::get('lasallecmscontact.from_email'), Config::get('lasallecmscontact.from_name')); $message->to($emailData['to_email'], $emailData['to_name']); $message->subject($emailData['subject']); }); } return true; }
[ "public", "function", "sendEmails", "(", "$", "listID", ",", "$", "data", ")", "{", "// if the list is not enabled, then return false", "if", "(", "!", "$", "this", "->", "helpers", "->", "isListEnabled", "(", "$", "listID", ")", ")", "{", "return", "false", ";", "}", "$", "emailData", "=", "[", "]", ";", "// subject", "$", "emailData", "[", "'subject'", "]", "=", "$", "this", "->", "helpers", "->", "getListNameFromListID", "(", "$", "listID", ")", ".", "' - '", ".", "$", "data", "[", "'title'", "]", ";", "// build the individual emails", "$", "emailIDs", "=", "$", "this", "->", "helpers", "->", "getEnabledEmailsFromList", "(", "$", "listID", ")", ";", "if", "(", "count", "(", "$", "emailIDs", ")", "==", "0", ")", "{", "// for some reason, maybe mismatched list_id #'s, finding no emails", "return", "false", ";", "}", "// link to the post", "$", "data", "[", "'link'", "]", "=", "'<a href=\"'", ";", "$", "data", "[", "'link'", "]", ".=", "$", "data", "[", "'canonical_url'", "]", ";", "$", "data", "[", "'link'", "]", ".=", "'\">'", ";", "$", "data", "[", "'link'", "]", ".=", "$", "data", "[", "'title'", "]", ";", "$", "data", "[", "'link'", "]", ".=", "'</a>'", ";", "// iterate through each email address, prepping and sending each email individually!", "foreach", "(", "$", "emailIDs", "as", "$", "emailID", ")", "{", "// if emails must be type \"primary\" AND the email is *not* type primary, do not process", "if", "(", "!", "$", "this", "->", "helpers", "->", "isEmailAddressPrimaryType", "(", "$", "emailID", "->", "email_id", ")", ")", "{", "continue", ";", "}", "///////////////////////////////////////////////////////////////////////////////////////////", "//// Unsubscribe from List ////", "///////////////////////////////////////////////////////////////////////////////////////////", "// Create a token", "$", "unsubscribeToken", "=", "$", "this", "->", "createUnsubscribeToken", "->", "createUniqueToken", "(", ")", ";", "// INSERT to the list_unsubscribe_token database table", "$", "this", "->", "createUnsubscribeToken", "->", "createTokenRecord", "(", "$", "listID", ",", "$", "emailID", "->", "email_id", ",", "$", "unsubscribeToken", ")", ";", "// Build the unsubscribe link", "$", "data", "[", "'unsubscribe_link'", "]", "=", "$", "this", "->", "createUnsubscribeToken", "->", "unsubscribeURL", "(", "$", "unsubscribeToken", ")", ";", "///////////////////////////////////////////////////////////////////////////////////////////", "//// Send email to a list recipient ////", "///////////////////////////////////////////////////////////////////////////////////////////", "// get the actual email address from the \"email_id\" field in the \"list_email\" db table", "$", "emailData", "[", "'to_email'", "]", "=", "$", "this", "->", "helpers", "->", "getEmailAddressFromEmailID", "(", "$", "emailID", "->", "email_id", ")", ";", "// get the person's first name and surname", "$", "emailData", "[", "'to_name'", "]", "=", "$", "this", "->", "helpers", "->", "getFirstnameSurnameFromEmailID", "(", "$", "emailID", "->", "email_id", ")", ";", "$", "data", "[", "'to_email'", "]", "=", "$", "emailData", "[", "'to_email'", "]", ";", "$", "data", "[", "'to_name'", "]", "=", "$", "emailData", "[", "'to_name'", "]", ";", "// send the email one-at-a-time", "// note the queue-ing", "Mail", "::", "queue", "(", "'lasallecrmlistmanagement::emails.send_email_from_list'", ",", "[", "'data'", "=>", "$", "data", "]", ",", "function", "(", "$", "message", ")", "use", "(", "$", "emailData", ")", "{", "$", "message", "->", "from", "(", "Config", "::", "get", "(", "'lasallecmscontact.from_email'", ")", ",", "Config", "::", "get", "(", "'lasallecmscontact.from_name'", ")", ")", ";", "$", "message", "->", "to", "(", "$", "emailData", "[", "'to_email'", "]", ",", "$", "emailData", "[", "'to_name'", "]", ")", ";", "$", "message", "->", "subject", "(", "$", "emailData", "[", "'subject'", "]", ")", ";", "}", ")", ";", "}", "return", "true", ";", "}" ]
Send emails from a list. Expected that this method called from another package, via an event job @param int $listID Database table "lists" ID @param array $data Post's title, body, etc @return bool
[ "Send", "emails", "from", "a", "list", "." ]
4b5da1af5d25d5fb4be5199f3cf22da313d475f3
https://github.com/lasallecrm/lasallecrm-l5-listmanagement-pkg/blob/4b5da1af5d25d5fb4be5199f3cf22da313d475f3/src/SendEmails/SendEmailsFromList.php#L80-L152
8,124
codebobbly/dvoconnector
Classes/Domain/Model/Functionary.php
Functionary.getPhotoSourceFile
public function getPhotoSourceFile() { $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); return $objectManager->get(\RGU\Dvoconnector\Service\ImageService::class)->getCachedFile($this->getPhotoSource()); }
php
public function getPhotoSourceFile() { $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); return $objectManager->get(\RGU\Dvoconnector\Service\ImageService::class)->getCachedFile($this->getPhotoSource()); }
[ "public", "function", "getPhotoSourceFile", "(", ")", "{", "$", "objectManager", "=", "\\", "TYPO3", "\\", "CMS", "\\", "Core", "\\", "Utility", "\\", "GeneralUtility", "::", "makeInstance", "(", "\\", "TYPO3", "\\", "CMS", "\\", "Extbase", "\\", "Object", "\\", "ObjectManager", "::", "class", ")", ";", "return", "$", "objectManager", "->", "get", "(", "\\", "RGU", "\\", "Dvoconnector", "\\", "Service", "\\", "ImageService", "::", "class", ")", "->", "getCachedFile", "(", "$", "this", "->", "getPhotoSource", "(", ")", ")", ";", "}" ]
returns the photoSource as File @return \TYPO3\CMS\Core\Resource\File
[ "returns", "the", "photoSource", "as", "File" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Model/Functionary.php#L394-L398
8,125
rinvex/obsolete-attributable
src/Models/Attribute.php
Attribute.getEntitiesAttribute
public function getEntitiesAttribute() { return DB::table(config('rinvex.attributable.tables.attribute_entity'))->where('attribute_id', $this->getKey())->get()->pluck('entity_type')->toArray(); }
php
public function getEntitiesAttribute() { return DB::table(config('rinvex.attributable.tables.attribute_entity'))->where('attribute_id', $this->getKey())->get()->pluck('entity_type')->toArray(); }
[ "public", "function", "getEntitiesAttribute", "(", ")", "{", "return", "DB", "::", "table", "(", "config", "(", "'rinvex.attributable.tables.attribute_entity'", ")", ")", "->", "where", "(", "'attribute_id'", ",", "$", "this", "->", "getKey", "(", ")", ")", "->", "get", "(", ")", "->", "pluck", "(", "'entity_type'", ")", "->", "toArray", "(", ")", ";", "}" ]
Get the entities attached to this attribute. @return \Illuminate\Support\Collection|null
[ "Get", "the", "entities", "attached", "to", "this", "attribute", "." ]
23fa78efda9c24e2e1579917967537a3b3b9e4ce
https://github.com/rinvex/obsolete-attributable/blob/23fa78efda9c24e2e1579917967537a3b3b9e4ce/src/Models/Attribute.php#L184-L187
8,126
DanielSiepmann/AtomicKitten.Framework
Classes/AtomicKitten/Framework/Command/CommandController.php
CommandController.outputLine
protected function outputLine($text = '', array $arguments = [], $status = self::RESET) { $text = $status . $text . static::RESET; return parent::outputLine($text, $arguments); }
php
protected function outputLine($text = '', array $arguments = [], $status = self::RESET) { $text = $status . $text . static::RESET; return parent::outputLine($text, $arguments); }
[ "protected", "function", "outputLine", "(", "$", "text", "=", "''", ",", "array", "$", "arguments", "=", "[", "]", ",", "$", "status", "=", "self", "::", "RESET", ")", "{", "$", "text", "=", "$", "status", ".", "$", "text", ".", "static", "::", "RESET", ";", "return", "parent", "::", "outputLine", "(", "$", "text", ",", "$", "arguments", ")", ";", "}" ]
Overwrite default outputLine to provide third parameter that will color the provided text. @param string $text Text to output. @param array $arguments Optional arguments to use for sprintf. @param string $status The status the output has, will be used to apply color. @return void
[ "Overwrite", "default", "outputLine", "to", "provide", "third", "parameter", "that", "will", "color", "the", "provided", "text", "." ]
2b08867098459994ef3c1353863d813b2ac6d55a
https://github.com/DanielSiepmann/AtomicKitten.Framework/blob/2b08867098459994ef3c1353863d813b2ac6d55a/Classes/AtomicKitten/Framework/Command/CommandController.php#L42-L46
8,127
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.error
private function error(): void { $code = socket_last_error($this->socket); $msg = socket_strerror($code); throw new \RuntimeException($msg, $code); }
php
private function error(): void { $code = socket_last_error($this->socket); $msg = socket_strerror($code); throw new \RuntimeException($msg, $code); }
[ "private", "function", "error", "(", ")", ":", "void", "{", "$", "code", "=", "socket_last_error", "(", "$", "this", "->", "socket", ")", ";", "$", "msg", "=", "socket_strerror", "(", "$", "code", ")", ";", "throw", "new", "\\", "RuntimeException", "(", "$", "msg", ",", "$", "code", ")", ";", "}" ]
Compose RuntimeException from socket error and throws it. @return void @throws \RuntimeException
[ "Compose", "RuntimeException", "from", "socket", "error", "and", "throws", "it", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L75-L81
8,128
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.connect
private function connect():void { socket_connect($this->socket, $this->host, $this->port) or $this->error(); }
php
private function connect():void { socket_connect($this->socket, $this->host, $this->port) or $this->error(); }
[ "private", "function", "connect", "(", ")", ":", "void", "{", "socket_connect", "(", "$", "this", "->", "socket", ",", "$", "this", "->", "host", ",", "$", "this", "->", "port", ")", "or", "$", "this", "->", "error", "(", ")", ";", "}" ]
Connect socket to server. @return void @throws \RuntimeException
[ "Connect", "socket", "to", "server", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L90-L95
8,129
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.send
private function send(string $data):void { socket_write($this->socket, $data, strlen($data)) or $this->error(); }
php
private function send(string $data):void { socket_write($this->socket, $data, strlen($data)) or $this->error(); }
[ "private", "function", "send", "(", "string", "$", "data", ")", ":", "void", "{", "socket_write", "(", "$", "this", "->", "socket", ",", "$", "data", ",", "strlen", "(", "$", "data", ")", ")", "or", "$", "this", "->", "error", "(", ")", ";", "}" ]
Send raw data to socket. @param string $data Data to send to opened socket. @return void @throws \RuntimeException
[ "Send", "raw", "data", "to", "socket", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L106-L111
8,130
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.sendRequest
protected function sendRequest(Request $request): Response { // Set password authentication for request. if ($this->password !== null) { $request->authenticate($this->password); } $this->send((string) $request); $response = new Response($this->get()); return $response; }
php
protected function sendRequest(Request $request): Response { // Set password authentication for request. if ($this->password !== null) { $request->authenticate($this->password); } $this->send((string) $request); $response = new Response($this->get()); return $response; }
[ "protected", "function", "sendRequest", "(", "Request", "$", "request", ")", ":", "Response", "{", "// Set password authentication for request.", "if", "(", "$", "this", "->", "password", "!==", "null", ")", "{", "$", "request", "->", "authenticate", "(", "$", "this", "->", "password", ")", ";", "}", "$", "this", "->", "send", "(", "(", "string", ")", "$", "request", ")", ";", "$", "response", "=", "new", "Response", "(", "$", "this", "->", "get", "(", ")", ")", ";", "return", "$", "response", ";", "}" ]
Send SNP Request message to server. @param Request $request @return Response @throws \bTd\SNP\Protocol\Message\Response\ErrorResponseException|\Exception
[ "Send", "SNP", "Request", "message", "to", "server", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L135-L146
8,131
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.notify
public function notify(NotifyRequest $notification): Response { if ($this->appID !== null) { $notification->setApplicationIdentification($this->appID); } $response = $this->sendRequest($notification); return $response; }
php
public function notify(NotifyRequest $notification): Response { if ($this->appID !== null) { $notification->setApplicationIdentification($this->appID); } $response = $this->sendRequest($notification); return $response; }
[ "public", "function", "notify", "(", "NotifyRequest", "$", "notification", ")", ":", "Response", "{", "if", "(", "$", "this", "->", "appID", "!==", "null", ")", "{", "$", "notification", "->", "setApplicationIdentification", "(", "$", "this", "->", "appID", ")", ";", "}", "$", "response", "=", "$", "this", "->", "sendRequest", "(", "$", "notification", ")", ";", "return", "$", "response", ";", "}" ]
Send SNP Notify Request message to server. @param NotifyRequest $notification @return Response @throws \bTd\SNP\Protocol\Message\Response\ErrorResponseException
[ "Send", "SNP", "Notify", "Request", "message", "to", "server", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L157-L166
8,132
neradp/SNPClient
src/bTd/SNP/Client/Client.php
Client.register
public function register(RegisterRequest $application): Response { $response = $this->sendRequest($application); $this->appID = $application->getApplicationIdentification(); return $response; }
php
public function register(RegisterRequest $application): Response { $response = $this->sendRequest($application); $this->appID = $application->getApplicationIdentification(); return $response; }
[ "public", "function", "register", "(", "RegisterRequest", "$", "application", ")", ":", "Response", "{", "$", "response", "=", "$", "this", "->", "sendRequest", "(", "$", "application", ")", ";", "$", "this", "->", "appID", "=", "$", "application", "->", "getApplicationIdentification", "(", ")", ";", "return", "$", "response", ";", "}" ]
Send SNP Register Request message to server. @param RegisterRequest $application @return Response @throws \bTd\SNP\Protocol\Message\Response\ErrorResponseException
[ "Send", "SNP", "Register", "Request", "message", "to", "server", "." ]
68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc
https://github.com/neradp/SNPClient/blob/68a7ddf0fe7c0a5b64417cb27aed190c029fcfcc/src/bTd/SNP/Client/Client.php#L177-L184
8,133
sebardo/core
CoreBundle/Entity/Image.php
Image.moveFile
protected function moveFile() { // if there is an error when moving the file, an exception will // be automatically thrown by move(). This will properly prevent // the entity from being persisted to the database on error $this->getFile()->move($this->getUploadRootDir(), $this->path); $this->setFile(null); }
php
protected function moveFile() { // if there is an error when moving the file, an exception will // be automatically thrown by move(). This will properly prevent // the entity from being persisted to the database on error $this->getFile()->move($this->getUploadRootDir(), $this->path); $this->setFile(null); }
[ "protected", "function", "moveFile", "(", ")", "{", "// if there is an error when moving the file, an exception will", "// be automatically thrown by move(). This will properly prevent", "// the entity from being persisted to the database on error", "$", "this", "->", "getFile", "(", ")", "->", "move", "(", "$", "this", "->", "getUploadRootDir", "(", ")", ",", "$", "this", "->", "path", ")", ";", "$", "this", "->", "setFile", "(", "null", ")", ";", "}" ]
Move file to its final location
[ "Move", "file", "to", "its", "final", "location" ]
d063334639dd717406c97ea4da9f4b260d0af4f4
https://github.com/sebardo/core/blob/d063334639dd717406c97ea4da9f4b260d0af4f4/CoreBundle/Entity/Image.php#L245-L253
8,134
weavephp/config-zend
src/Zend.php
Zend.loadConfig
protected function loadConfig($environment = null, $configLocation = null) { $aggregator = new ConfigAggregator( [ new ZendConfigProvider(realpath($configLocation . '/') . '/' . $environment . '.{json,xml,ini}'), ] ); return $aggregator->getMergedConfig(); }
php
protected function loadConfig($environment = null, $configLocation = null) { $aggregator = new ConfigAggregator( [ new ZendConfigProvider(realpath($configLocation . '/') . '/' . $environment . '.{json,xml,ini}'), ] ); return $aggregator->getMergedConfig(); }
[ "protected", "function", "loadConfig", "(", "$", "environment", "=", "null", ",", "$", "configLocation", "=", "null", ")", "{", "$", "aggregator", "=", "new", "ConfigAggregator", "(", "[", "new", "ZendConfigProvider", "(", "realpath", "(", "$", "configLocation", ".", "'/'", ")", ".", "'/'", ".", "$", "environment", ".", "'.{json,xml,ini}'", ")", ",", "]", ")", ";", "return", "$", "aggregator", "->", "getMergedConfig", "(", ")", ";", "}" ]
Load config and return as an array. Loads <emvironment>.{json, xml, ini} from configLocation. @param string $environment Runtime environment. @param string $configLocation Location from which to load config. @return array
[ "Load", "config", "and", "return", "as", "an", "array", "." ]
b033c010904d7513bccdff6ca213c5548d019c2b
https://github.com/weavephp/config-zend/blob/b033c010904d7513bccdff6ca213c5548d019c2b/src/Zend.php#L25-L33
8,135
wasabi-cms/core
src/Form/ContactForm.php
ContactForm._buildValidator
protected function _buildValidator(Validator $validator) { $validator->provider('googleRecaptcha', 'Wasabi\Core\Model\Validation\GoogleRecaptchaValidationProvider'); return $validator ->notEmpty('name', __d('wasabi_core', 'Please enter your name.')) ->notEmpty('email', __d('wasabi_core', 'Please enter your email address.')) ->add('email', 'email', ['rule' => 'email', 'message' => __d('wasabi_core', 'Please enter a valid email address.')]) ->notEmpty('subject', __d('wasabi_core', 'Please enter a subject for your contact request.')) ->notEmpty('message', __d('wasabi_core', 'Please provide a message for your contact request.')) ->notEmpty('g-recaptcha-response', __d('wasabi_core', 'Please confirm you are human.')) ->add('g-recaptcha-response', 'googleRecaptcha', [ 'rule' => 'googleRecaptcha', 'message' => __d('wasabi_core', 'Please confirm you are human.'), 'provider' => 'googleRecaptcha' ]); }
php
protected function _buildValidator(Validator $validator) { $validator->provider('googleRecaptcha', 'Wasabi\Core\Model\Validation\GoogleRecaptchaValidationProvider'); return $validator ->notEmpty('name', __d('wasabi_core', 'Please enter your name.')) ->notEmpty('email', __d('wasabi_core', 'Please enter your email address.')) ->add('email', 'email', ['rule' => 'email', 'message' => __d('wasabi_core', 'Please enter a valid email address.')]) ->notEmpty('subject', __d('wasabi_core', 'Please enter a subject for your contact request.')) ->notEmpty('message', __d('wasabi_core', 'Please provide a message for your contact request.')) ->notEmpty('g-recaptcha-response', __d('wasabi_core', 'Please confirm you are human.')) ->add('g-recaptcha-response', 'googleRecaptcha', [ 'rule' => 'googleRecaptcha', 'message' => __d('wasabi_core', 'Please confirm you are human.'), 'provider' => 'googleRecaptcha' ]); }
[ "protected", "function", "_buildValidator", "(", "Validator", "$", "validator", ")", "{", "$", "validator", "->", "provider", "(", "'googleRecaptcha'", ",", "'Wasabi\\Core\\Model\\Validation\\GoogleRecaptchaValidationProvider'", ")", ";", "return", "$", "validator", "->", "notEmpty", "(", "'name'", ",", "__d", "(", "'wasabi_core'", ",", "'Please enter your name.'", ")", ")", "->", "notEmpty", "(", "'email'", ",", "__d", "(", "'wasabi_core'", ",", "'Please enter your email address.'", ")", ")", "->", "add", "(", "'email'", ",", "'email'", ",", "[", "'rule'", "=>", "'email'", ",", "'message'", "=>", "__d", "(", "'wasabi_core'", ",", "'Please enter a valid email address.'", ")", "]", ")", "->", "notEmpty", "(", "'subject'", ",", "__d", "(", "'wasabi_core'", ",", "'Please enter a subject for your contact request.'", ")", ")", "->", "notEmpty", "(", "'message'", ",", "__d", "(", "'wasabi_core'", ",", "'Please provide a message for your contact request.'", ")", ")", "->", "notEmpty", "(", "'g-recaptcha-response'", ",", "__d", "(", "'wasabi_core'", ",", "'Please confirm you are human.'", ")", ")", "->", "add", "(", "'g-recaptcha-response'", ",", "'googleRecaptcha'", ",", "[", "'rule'", "=>", "'googleRecaptcha'", ",", "'message'", "=>", "__d", "(", "'wasabi_core'", ",", "'Please confirm you are human.'", ")", ",", "'provider'", "=>", "'googleRecaptcha'", "]", ")", ";", "}" ]
Validation rules for the submitted fields of this form. @param Validator $validator The validator to customize. @return $this
[ "Validation", "rules", "for", "the", "submitted", "fields", "of", "this", "form", "." ]
0eadbb64d2fc201bacc63c93814adeca70e08f90
https://github.com/wasabi-cms/core/blob/0eadbb64d2fc201bacc63c93814adeca70e08f90/src/Form/ContactForm.php#L44-L60
8,136
marando/phpSOFA
src/Marando/IAU/iauApci.php
iauApci.Apci
public static function Apci($date1, $date2, array $ebpv, array $ehp, $x, $y, $s, iauASTROM &$astrom) { /* Star-independent astrometry parameters for geocenter. */ IAU::Apcg($date1, $date2, $ebpv, $ehp, $astrom); /* CIO based BPN matrix. */ IAU::C2ixys($x, $y, $s, $astrom->bpn); /* Finished. */ }
php
public static function Apci($date1, $date2, array $ebpv, array $ehp, $x, $y, $s, iauASTROM &$astrom) { /* Star-independent astrometry parameters for geocenter. */ IAU::Apcg($date1, $date2, $ebpv, $ehp, $astrom); /* CIO based BPN matrix. */ IAU::C2ixys($x, $y, $s, $astrom->bpn); /* Finished. */ }
[ "public", "static", "function", "Apci", "(", "$", "date1", ",", "$", "date2", ",", "array", "$", "ebpv", ",", "array", "$", "ehp", ",", "$", "x", ",", "$", "y", ",", "$", "s", ",", "iauASTROM", "&", "$", "astrom", ")", "{", "/* Star-independent astrometry parameters for geocenter. */", "IAU", "::", "Apcg", "(", "$", "date1", ",", "$", "date2", ",", "$", "ebpv", ",", "$", "ehp", ",", "$", "astrom", ")", ";", "/* CIO based BPN matrix. */", "IAU", "::", "C2ixys", "(", "$", "x", ",", "$", "y", ",", "$", "s", ",", "$", "astrom", "->", "bpn", ")", ";", "/* Finished. */", "}" ]
- - - - - - - - i a u A p c i - - - - - - - - For a terrestrial observer, prepare star-independent astrometry parameters for transformations between ICRS and geocentric CIRS coordinates. The Earth ephemeris and CIP/CIO are supplied by the caller. The parameters produced by this function are required in the parallax, light deflection, aberration, and bias-precession-nutation parts of the astrometric transformation chain. This function is part of the International Astronomical Union's SOFA (Standards of Fundamental Astronomy) software collection. Status: support function. Given: date1 double TDB as a 2-part... date2 double ...Julian Date (Note 1) ebpv double[2][3] Earth barycentric position/velocity (au, au/day) ehp double[3] Earth heliocentric position (au) x,y double CIP X,Y (components of unit vector) s double the CIO locator s (radians) Returned: astrom iauASTROM* star-independent astrometry parameters: pmt double PM time interval (SSB, Julian years) eb double[3] SSB to observer (vector, au) eh double[3] Sun to observer (unit vector) em double distance from Sun to observer (au) v double[3] barycentric observer velocity (vector, c) bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor bpn double[3][3] bias-precession-nutation matrix along double unchanged xpl double unchanged ypl double unchanged sphi double unchanged cphi double unchanged diurab double unchanged eral double unchanged refa double unchanged refb double unchanged Notes: 1) The TDB date date1+date2 is a Julian Date, apportioned in any convenient way between the two arguments. For example, JD(TDB)=2450123.7 could be expressed in any of these ways, among others: date1 date2 2450123.7 0.0 (JD method) 2451545.0 -1421.3 (J2000 method) 2400000.5 50123.2 (MJD method) 2450123.5 0.2 (date & time method) The JD method is the most natural and convenient to use in cases where the loss of several decimal digits of resolution is acceptable. The J2000 method is best matched to the way the argument is handled internally and will deliver the optimum resolution. The MJD method and the date & time methods are both good compromises between resolution and convenience. For most applications of this function the choice will not be at all critical. TT can be used instead of TDB without any significant impact on accuracy. 2) All the vectors are with respect to BCRS axes. 3) In cases where the caller does not wish to provide the Earth ephemeris and CIP/CIO, the function iauApci13 can be used instead of the present function. This computes the required quantities using other SOFA functions. 4) This is one of several functions that inserts into the astrom structure star-independent parameters needed for the chain of astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed. The various functions support different classes of observer and portions of the transformation chain: functions observer transformation iauApcg iauApcg13 geocentric ICRS <-> GCRS iauApci iauApci13 terrestrial ICRS <-> CIRS iauApco iauApco13 terrestrial ICRS <-> observed iauApcs iauApcs13 space ICRS <-> GCRS iauAper iauAper13 terrestrial update Earth rotation iauApio iauApio13 terrestrial CIRS <-> observed Those with names ending in "13" use contemporary SOFA models to compute the various ephemerides. The others accept ephemerides supplied by the caller. The transformation from ICRS to GCRS covers space motion, parallax, light deflection, and aberration. From GCRS to CIRS comprises frame bias and precession-nutation. From CIRS to observed takes account of Earth rotation, polar motion, diurnal aberration and parallax (unless subsumed into the ICRS <-> GCRS transformation), and atmospheric refraction. 5) The context structure astrom produced by this function is used by iauAtciq* and iauAticq*. Called: iauApcg astrometry parameters, ICRS-GCRS, geocenter iauC2ixys celestial-to-intermediate matrix, given X,Y and s This revision: 2013 September 25 SOFA release 2015-02-09 Copyright (C) 2015 IAU SOFA Board. See notes at end.
[ "-", "-", "-", "-", "-", "-", "-", "-", "i", "a", "u", "A", "p", "c", "i", "-", "-", "-", "-", "-", "-", "-", "-" ]
757fa49fe335ae1210eaa7735473fd4388b13f07
https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauApci.php#L126-L136
8,137
phossa2/libs
src/Phossa2/Cache/Extension/StampedeProtection.php
StampedeProtection.stampedeProtect
public function stampedeProtect(EventInterface $event)/*# : bool */ { /* @var CachePool $pool */ $pool = $event->getTarget(); /* @var CacheItem $item */ $item = $event->getParam('item'); if ($item instanceof CacheItemExtendedInterface) { $left = $item->getExpiration()->getTimestamp() - time(); if ($left < $this->time_left && rand(1, 1000) <= $this->probability) { return $pool->setError( Message::get(Message::CACHE_EXT_STAMPEDE, $item->getKey()), Message::CACHE_EXT_STAMPEDE ); } } return true; }
php
public function stampedeProtect(EventInterface $event)/*# : bool */ { /* @var CachePool $pool */ $pool = $event->getTarget(); /* @var CacheItem $item */ $item = $event->getParam('item'); if ($item instanceof CacheItemExtendedInterface) { $left = $item->getExpiration()->getTimestamp() - time(); if ($left < $this->time_left && rand(1, 1000) <= $this->probability) { return $pool->setError( Message::get(Message::CACHE_EXT_STAMPEDE, $item->getKey()), Message::CACHE_EXT_STAMPEDE ); } } return true; }
[ "public", "function", "stampedeProtect", "(", "EventInterface", "$", "event", ")", "/*# : bool */", "{", "/* @var CachePool $pool */", "$", "pool", "=", "$", "event", "->", "getTarget", "(", ")", ";", "/* @var CacheItem $item */", "$", "item", "=", "$", "event", "->", "getParam", "(", "'item'", ")", ";", "if", "(", "$", "item", "instanceof", "CacheItemExtendedInterface", ")", "{", "$", "left", "=", "$", "item", "->", "getExpiration", "(", ")", "->", "getTimestamp", "(", ")", "-", "time", "(", ")", ";", "if", "(", "$", "left", "<", "$", "this", "->", "time_left", "&&", "rand", "(", "1", ",", "1000", ")", "<=", "$", "this", "->", "probability", ")", "{", "return", "$", "pool", "->", "setError", "(", "Message", "::", "get", "(", "Message", "::", "CACHE_EXT_STAMPEDE", ",", "$", "item", "->", "getKey", "(", ")", ")", ",", "Message", "::", "CACHE_EXT_STAMPEDE", ")", ";", "}", "}", "return", "true", ";", "}" ]
Change hit status if ... @param EventInterface $event @return bool @access public
[ "Change", "hit", "status", "if", "..." ]
921e485c8cc29067f279da2cdd06f47a9bddd115
https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Cache/Extension/StampedeProtection.php#L94-L112
8,138
reliv/validation-rat
src/Api/MergeValidationResultsFields.php
MergeValidationResultsFields.invoke
public static function invoke( ValidationResultFields $validationResultFields, ValidationResultFields $validationResultFieldsMore ): ValidationResultFields { $code = ''; if (!$validationResultFields->isValid()) { $code = $validationResultFields->getCode(); } if (!$validationResultFieldsMore->isValid()) { $code = $validationResultFieldsMore->getCode(); } $isValid = ($validationResultFields->isValid() && $validationResultFieldsMore->isValid()); $details = array_merge( $validationResultFields->getDetails(), $validationResultFieldsMore->getDetails() ); $mergedFieldResults = array_merge( $validationResultFields->getFieldResults(), $validationResultFieldsMore->getFieldResults() ); return new ValidationResultFieldsBasic( $isValid, $code, $details, $mergedFieldResults ); }
php
public static function invoke( ValidationResultFields $validationResultFields, ValidationResultFields $validationResultFieldsMore ): ValidationResultFields { $code = ''; if (!$validationResultFields->isValid()) { $code = $validationResultFields->getCode(); } if (!$validationResultFieldsMore->isValid()) { $code = $validationResultFieldsMore->getCode(); } $isValid = ($validationResultFields->isValid() && $validationResultFieldsMore->isValid()); $details = array_merge( $validationResultFields->getDetails(), $validationResultFieldsMore->getDetails() ); $mergedFieldResults = array_merge( $validationResultFields->getFieldResults(), $validationResultFieldsMore->getFieldResults() ); return new ValidationResultFieldsBasic( $isValid, $code, $details, $mergedFieldResults ); }
[ "public", "static", "function", "invoke", "(", "ValidationResultFields", "$", "validationResultFields", ",", "ValidationResultFields", "$", "validationResultFieldsMore", ")", ":", "ValidationResultFields", "{", "$", "code", "=", "''", ";", "if", "(", "!", "$", "validationResultFields", "->", "isValid", "(", ")", ")", "{", "$", "code", "=", "$", "validationResultFields", "->", "getCode", "(", ")", ";", "}", "if", "(", "!", "$", "validationResultFieldsMore", "->", "isValid", "(", ")", ")", "{", "$", "code", "=", "$", "validationResultFieldsMore", "->", "getCode", "(", ")", ";", "}", "$", "isValid", "=", "(", "$", "validationResultFields", "->", "isValid", "(", ")", "&&", "$", "validationResultFieldsMore", "->", "isValid", "(", ")", ")", ";", "$", "details", "=", "array_merge", "(", "$", "validationResultFields", "->", "getDetails", "(", ")", ",", "$", "validationResultFieldsMore", "->", "getDetails", "(", ")", ")", ";", "$", "mergedFieldResults", "=", "array_merge", "(", "$", "validationResultFields", "->", "getFieldResults", "(", ")", ",", "$", "validationResultFieldsMore", "->", "getFieldResults", "(", ")", ")", ";", "return", "new", "ValidationResultFieldsBasic", "(", "$", "isValid", ",", "$", "code", ",", "$", "details", ",", "$", "mergedFieldResults", ")", ";", "}" ]
Second ValidationResultFields will over-ride the first @param ValidationResultFields $validationResultFields @param ValidationResultFields $validationResultFieldsMore @return ValidationResultFields @throws \Exception
[ "Second", "ValidationResultFields", "will", "over", "-", "ride", "the", "first" ]
1232a6677eccf6fbc2f86bc8c82039687a503f16
https://github.com/reliv/validation-rat/blob/1232a6677eccf6fbc2f86bc8c82039687a503f16/src/Api/MergeValidationResultsFields.php#L22-L54
8,139
remote-office/libx
src/Dom/Document.php
Document.getXPath
public function getXPath() { if(!isset($this->xpath)) { $this->xpath = new DOMXPath($this); if($this->documentElement->namespaceURI <> '') $this->xpath->registerNamespace('default', $this->documentElement->namespaceURI); /*foreach ($this->getNamespaces() as $prefix => $namespaceUri) $this->xpath->registerNamespace($prefix, $namespaceUri);*/ } return $this->xpath; }
php
public function getXPath() { if(!isset($this->xpath)) { $this->xpath = new DOMXPath($this); if($this->documentElement->namespaceURI <> '') $this->xpath->registerNamespace('default', $this->documentElement->namespaceURI); /*foreach ($this->getNamespaces() as $prefix => $namespaceUri) $this->xpath->registerNamespace($prefix, $namespaceUri);*/ } return $this->xpath; }
[ "public", "function", "getXPath", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "xpath", ")", ")", "{", "$", "this", "->", "xpath", "=", "new", "DOMXPath", "(", "$", "this", ")", ";", "if", "(", "$", "this", "->", "documentElement", "->", "namespaceURI", "<>", "''", ")", "$", "this", "->", "xpath", "->", "registerNamespace", "(", "'default'", ",", "$", "this", "->", "documentElement", "->", "namespaceURI", ")", ";", "/*foreach ($this->getNamespaces() as $prefix => $namespaceUri)\n $this->xpath->registerNamespace($prefix, $namespaceUri);*/", "}", "return", "$", "this", "->", "xpath", ";", "}" ]
Get DOMXPath for this Document @return DOMXPath
[ "Get", "DOMXPath", "for", "this", "Document" ]
8baeaae99a6110e7c588bc0388df89a0dc0768b5
https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/Dom/Document.php#L39-L53
8,140
remote-office/libx
src/Dom/Document.php
Document.getNamespaces
private function getNamespaces() { $this->namespaces = array(); $nodeList = $this->documentElement->getElementsByTagName('*'); foreach($nodeList as $node) { if (strlen($node->prefix) && strlen($node->namespaceURI) && !in_array($node->prefix, $this->namespaces)) $this->namespaces[$node->prefix] = $node->namespaceURI; } return $this->namespaces; }
php
private function getNamespaces() { $this->namespaces = array(); $nodeList = $this->documentElement->getElementsByTagName('*'); foreach($nodeList as $node) { if (strlen($node->prefix) && strlen($node->namespaceURI) && !in_array($node->prefix, $this->namespaces)) $this->namespaces[$node->prefix] = $node->namespaceURI; } return $this->namespaces; }
[ "private", "function", "getNamespaces", "(", ")", "{", "$", "this", "->", "namespaces", "=", "array", "(", ")", ";", "$", "nodeList", "=", "$", "this", "->", "documentElement", "->", "getElementsByTagName", "(", "'*'", ")", ";", "foreach", "(", "$", "nodeList", "as", "$", "node", ")", "{", "if", "(", "strlen", "(", "$", "node", "->", "prefix", ")", "&&", "strlen", "(", "$", "node", "->", "namespaceURI", ")", "&&", "!", "in_array", "(", "$", "node", "->", "prefix", ",", "$", "this", "->", "namespaces", ")", ")", "$", "this", "->", "namespaces", "[", "$", "node", "->", "prefix", "]", "=", "$", "node", "->", "namespaceURI", ";", "}", "return", "$", "this", "->", "namespaces", ";", "}" ]
Get the list of namespaces of this Document @return array
[ "Get", "the", "list", "of", "namespaces", "of", "this", "Document" ]
8baeaae99a6110e7c588bc0388df89a0dc0768b5
https://github.com/remote-office/libx/blob/8baeaae99a6110e7c588bc0388df89a0dc0768b5/src/Dom/Document.php#L60-L73
8,141
n0m4dz/laracasa
Zend/Gdata/Spreadsheets/DocumentQuery.php
Zend_Gdata_Spreadsheets_DocumentQuery.setTitle
public function setTitle($value) { if ($value != null) { $this->_params['title'] = $value; } else { unset($this->_params['title']); } return $this; }
php
public function setTitle($value) { if ($value != null) { $this->_params['title'] = $value; } else { unset($this->_params['title']); } return $this; }
[ "public", "function", "setTitle", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!=", "null", ")", "{", "$", "this", "->", "_params", "[", "'title'", "]", "=", "$", "value", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "_params", "[", "'title'", "]", ")", ";", "}", "return", "$", "this", ";", "}" ]
Sets the title attribute for this query. @param string $value @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
[ "Sets", "the", "title", "attribute", "for", "this", "query", "." ]
6141f0c16c7d4453275e3b74be5041f336085c91
https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Spreadsheets/DocumentQuery.php#L169-L177
8,142
n0m4dz/laracasa
Zend/Gdata/Spreadsheets/DocumentQuery.php
Zend_Gdata_Spreadsheets_DocumentQuery.setTitleExact
public function setTitleExact($value) { if ($value != null) { $this->_params['title-exact'] = $value; } else { unset($this->_params['title-exact']); } return $this; }
php
public function setTitleExact($value) { if ($value != null) { $this->_params['title-exact'] = $value; } else { unset($this->_params['title-exact']); } return $this; }
[ "public", "function", "setTitleExact", "(", "$", "value", ")", "{", "if", "(", "$", "value", "!=", "null", ")", "{", "$", "this", "->", "_params", "[", "'title-exact'", "]", "=", "$", "value", ";", "}", "else", "{", "unset", "(", "$", "this", "->", "_params", "[", "'title-exact'", "]", ")", ";", "}", "return", "$", "this", ";", "}" ]
Sets the title-exact attribute for this query. @param string $value @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface
[ "Sets", "the", "title", "-", "exact", "attribute", "for", "this", "query", "." ]
6141f0c16c7d4453275e3b74be5041f336085c91
https://github.com/n0m4dz/laracasa/blob/6141f0c16c7d4453275e3b74be5041f336085c91/Zend/Gdata/Spreadsheets/DocumentQuery.php#L184-L192
8,143
wigedev/simple-mvc
src/Renderer/ViewHelper/ScriptHelper.php
ScriptHelper.append
public function append() { $script = $this->parseArgs(func_get_args()); if ($script !== false && !in_array($script, $this->members)) array_push($this->members, $script); }
php
public function append() { $script = $this->parseArgs(func_get_args()); if ($script !== false && !in_array($script, $this->members)) array_push($this->members, $script); }
[ "public", "function", "append", "(", ")", "{", "$", "script", "=", "$", "this", "->", "parseArgs", "(", "func_get_args", "(", ")", ")", ";", "if", "(", "$", "script", "!==", "false", "&&", "!", "in_array", "(", "$", "script", ",", "$", "this", "->", "members", ")", ")", "array_push", "(", "$", "this", "->", "members", ",", "$", "script", ")", ";", "}" ]
Add the passed value to the end of the collection
[ "Add", "the", "passed", "value", "to", "the", "end", "of", "the", "collection" ]
b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94
https://github.com/wigedev/simple-mvc/blob/b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94/src/Renderer/ViewHelper/ScriptHelper.php#L52-L56
8,144
wigedev/simple-mvc
src/Renderer/ViewHelper/ScriptHelper.php
ScriptHelper.prepend
public function prepend() { $script = $this->parseArgs(func_get_args()); if ($script !== false && !in_array($script, $this->members)) array_unshift($this->members, $script); }
php
public function prepend() { $script = $this->parseArgs(func_get_args()); if ($script !== false && !in_array($script, $this->members)) array_unshift($this->members, $script); }
[ "public", "function", "prepend", "(", ")", "{", "$", "script", "=", "$", "this", "->", "parseArgs", "(", "func_get_args", "(", ")", ")", ";", "if", "(", "$", "script", "!==", "false", "&&", "!", "in_array", "(", "$", "script", ",", "$", "this", "->", "members", ")", ")", "array_unshift", "(", "$", "this", "->", "members", ",", "$", "script", ")", ";", "}" ]
Add the passed value to the beginning of the collection
[ "Add", "the", "passed", "value", "to", "the", "beginning", "of", "the", "collection" ]
b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94
https://github.com/wigedev/simple-mvc/blob/b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94/src/Renderer/ViewHelper/ScriptHelper.php#L61-L65
8,145
wigedev/simple-mvc
src/Renderer/ViewHelper/ScriptHelper.php
ScriptHelper.parseArgs
private function parseArgs(array $args) : string { if (!is_array($args)) return false; $components = array(); if (count($args) == 1 && is_string($args[0])) { $components['src'] = $args[0]; return $this->makeLink($components); } elseif (count($args) == 1 && is_array($args)) { $components = $args[0]; return $this->makeLink($components); } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) { $args[1]['src'] = $args[0]; $components = $args[1]; return $this->makeLink($components); } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) { return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n"; } Core::i()->log->warning('Unable to interpret script. Not added.'); return false; }
php
private function parseArgs(array $args) : string { if (!is_array($args)) return false; $components = array(); if (count($args) == 1 && is_string($args[0])) { $components['src'] = $args[0]; return $this->makeLink($components); } elseif (count($args) == 1 && is_array($args)) { $components = $args[0]; return $this->makeLink($components); } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) { $args[1]['src'] = $args[0]; $components = $args[1]; return $this->makeLink($components); } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) { return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n"; } Core::i()->log->warning('Unable to interpret script. Not added.'); return false; }
[ "private", "function", "parseArgs", "(", "array", "$", "args", ")", ":", "string", "{", "if", "(", "!", "is_array", "(", "$", "args", ")", ")", "return", "false", ";", "$", "components", "=", "array", "(", ")", ";", "if", "(", "count", "(", "$", "args", ")", "==", "1", "&&", "is_string", "(", "$", "args", "[", "0", "]", ")", ")", "{", "$", "components", "[", "'src'", "]", "=", "$", "args", "[", "0", "]", ";", "return", "$", "this", "->", "makeLink", "(", "$", "components", ")", ";", "}", "elseif", "(", "count", "(", "$", "args", ")", "==", "1", "&&", "is_array", "(", "$", "args", ")", ")", "{", "$", "components", "=", "$", "args", "[", "0", "]", ";", "return", "$", "this", "->", "makeLink", "(", "$", "components", ")", ";", "}", "elseif", "(", "count", "(", "$", "args", ")", "==", "2", "&&", "is_string", "(", "$", "args", "[", "0", "]", ")", "&&", "is_array", "(", "$", "args", "[", "1", "]", ")", ")", "{", "$", "args", "[", "1", "]", "[", "'src'", "]", "=", "$", "args", "[", "0", "]", ";", "$", "components", "=", "$", "args", "[", "1", "]", ";", "return", "$", "this", "->", "makeLink", "(", "$", "components", ")", ";", "}", "elseif", "(", "count", "(", "$", "args", ")", "==", "2", "&&", "is_string", "(", "$", "args", "[", "0", "]", ")", "&&", "is_string", "(", "$", "args", "[", "1", "]", ")", ")", "{", "return", "'<script type=\"'", ".", "$", "args", "[", "1", "]", ".", "'\">'", ".", "\"\\n\"", ".", "$", "args", "[", "0", "]", ".", "\"\\n</script>\\n\"", ";", "}", "Core", "::", "i", "(", ")", "->", "log", "->", "warning", "(", "'Unable to interpret script. Not added.'", ")", ";", "return", "false", ";", "}" ]
Builds the tag based on the passed info. @param array $args @return string
[ "Builds", "the", "tag", "based", "on", "the", "passed", "info", "." ]
b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94
https://github.com/wigedev/simple-mvc/blob/b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94/src/Renderer/ViewHelper/ScriptHelper.php#L97-L116
8,146
phpboletos/support
src/Tools.php
Tools.fatorVencimento
public static function fatorVencimento($vencimento) { // Quando o vencimento for vazio ou não informado deve retornar o fator ZERO, para os casos de cartão de credito... if (($vencimento === null) || ($vencimento === '')) { return 0; } $base = Carbon::createFromFormat('d.m.Y', '07.10.1997'); if (! ($vencimento instanceof \DateTime)) { $vencimento = Carbon::createFromTimestamp($vencimento); } return $base->diffInDays() - $vencimento->diffInDays(); }
php
public static function fatorVencimento($vencimento) { // Quando o vencimento for vazio ou não informado deve retornar o fator ZERO, para os casos de cartão de credito... if (($vencimento === null) || ($vencimento === '')) { return 0; } $base = Carbon::createFromFormat('d.m.Y', '07.10.1997'); if (! ($vencimento instanceof \DateTime)) { $vencimento = Carbon::createFromTimestamp($vencimento); } return $base->diffInDays() - $vencimento->diffInDays(); }
[ "public", "static", "function", "fatorVencimento", "(", "$", "vencimento", ")", "{", "// Quando o vencimento for vazio ou não informado deve retornar o fator ZERO, para os casos de cartão de credito...", "if", "(", "(", "$", "vencimento", "===", "null", ")", "||", "(", "$", "vencimento", "===", "''", ")", ")", "{", "return", "0", ";", "}", "$", "base", "=", "Carbon", "::", "createFromFormat", "(", "'d.m.Y'", ",", "'07.10.1997'", ")", ";", "if", "(", "!", "(", "$", "vencimento", "instanceof", "\\", "DateTime", ")", ")", "{", "$", "vencimento", "=", "Carbon", "::", "createFromTimestamp", "(", "$", "vencimento", ")", ";", "}", "return", "$", "base", "->", "diffInDays", "(", ")", "-", "$", "vencimento", "->", "diffInDays", "(", ")", ";", "}" ]
Retorna o fator de vencimento. @param string|\Datetime|Carbon $vencimento. @return int
[ "Retorna", "o", "fator", "de", "vencimento", "." ]
6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f
https://github.com/phpboletos/support/blob/6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f/src/Tools.php#L13-L26
8,147
phpboletos/support
src/Tools.php
Tools.dataPeloFator
public static function dataPeloFator($fator) { $fator = intval($fator); $base = Carbon::createFromFormat('d.m.Y', '07.10.1997'); return $base->addDays($fator); }
php
public static function dataPeloFator($fator) { $fator = intval($fator); $base = Carbon::createFromFormat('d.m.Y', '07.10.1997'); return $base->addDays($fator); }
[ "public", "static", "function", "dataPeloFator", "(", "$", "fator", ")", "{", "$", "fator", "=", "intval", "(", "$", "fator", ")", ";", "$", "base", "=", "Carbon", "::", "createFromFormat", "(", "'d.m.Y'", ",", "'07.10.1997'", ")", ";", "return", "$", "base", "->", "addDays", "(", "$", "fator", ")", ";", "}" ]
Retorna a data pelo fator de vencimento. @param $fator @return Carbon
[ "Retorna", "a", "data", "pelo", "fator", "de", "vencimento", "." ]
6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f
https://github.com/phpboletos/support/blob/6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f/src/Tools.php#L34-L40
8,148
phpboletos/support
src/Tools.php
Tools.valorPeloFator
public static function valorPeloFator($fator, $dec = 2) { $div = pow(10, $dec); $base = intval(round($fator, 0)); return $base / $div; }
php
public static function valorPeloFator($fator, $dec = 2) { $div = pow(10, $dec); $base = intval(round($fator, 0)); return $base / $div; }
[ "public", "static", "function", "valorPeloFator", "(", "$", "fator", ",", "$", "dec", "=", "2", ")", "{", "$", "div", "=", "pow", "(", "10", ",", "$", "dec", ")", ";", "$", "base", "=", "intval", "(", "round", "(", "$", "fator", ",", "0", ")", ")", ";", "return", "$", "base", "/", "$", "div", ";", "}" ]
Retorna o valor pelo fator de valor. @param $fator @param int $dec @return float
[ "Retorna", "o", "valor", "pelo", "fator", "de", "valor", "." ]
6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f
https://github.com/phpboletos/support/blob/6086a8680b0319ce82ebf74e9c2b9fd8fd991e9f/src/Tools.php#L49-L55
8,149
railsphp/framework
src/Rails/ActiveModel/Attributes/AttributedModelTrait.php
AttributedModelTrait.initAttributeSet
protected static function initAttributeSet() { $className = get_called_class(); if (!ModelAttributes::attributesSetFor($className)) { ModelAttributes::setClassAttributes( $className, static::attributeSet() ); } }
php
protected static function initAttributeSet() { $className = get_called_class(); if (!ModelAttributes::attributesSetFor($className)) { ModelAttributes::setClassAttributes( $className, static::attributeSet() ); } }
[ "protected", "static", "function", "initAttributeSet", "(", ")", "{", "$", "className", "=", "get_called_class", "(", ")", ";", "if", "(", "!", "ModelAttributes", "::", "attributesSetFor", "(", "$", "className", ")", ")", "{", "ModelAttributes", "::", "setClassAttributes", "(", "$", "className", ",", "static", "::", "attributeSet", "(", ")", ")", ";", "}", "}" ]
This method may be overridden to actually set the attribues. @return void
[ "This", "method", "may", "be", "overridden", "to", "actually", "set", "the", "attribues", "." ]
2ac9d3e493035dcc68f3c3812423327127327cd5
https://github.com/railsphp/framework/blob/2ac9d3e493035dcc68f3c3812423327127327cd5/src/Rails/ActiveModel/Attributes/AttributedModelTrait.php#L27-L37
8,150
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.factory
public static function factory($config = []) { $default = [ 'url' => 'https://syrup.keboola.com/gooddata-writer' ]; $required = ['token']; $config = Collection::fromConfig($config, $default, $required); $config['request.options'] = [ 'headers' => [ 'X-StorageApi-Token' => $config->get('token') ], 'config' => [ 'curl' => [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0 ] ] ]; $client = new self($config->get('url'), $config); // Attach a service description to the client $description = ServiceDescription::factory(__DIR__ . '/service.json'); $client->setDescription($description); $client->setBaseUrl($config->get('url')); // Setup exponential backoff // 503 retry always, other errors five times $backoffPlugin = new BackoffPlugin(new TruncatedBackoffStrategy( 5, new HttpBackoffStrategy( null, new CurlBackoffStrategy( null, new ExponentialBackoffStrategy() ) ) )); $client->addSubscriber($backoffPlugin); return $client; }
php
public static function factory($config = []) { $default = [ 'url' => 'https://syrup.keboola.com/gooddata-writer' ]; $required = ['token']; $config = Collection::fromConfig($config, $default, $required); $config['request.options'] = [ 'headers' => [ 'X-StorageApi-Token' => $config->get('token') ], 'config' => [ 'curl' => [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0 ] ] ]; $client = new self($config->get('url'), $config); // Attach a service description to the client $description = ServiceDescription::factory(__DIR__ . '/service.json'); $client->setDescription($description); $client->setBaseUrl($config->get('url')); // Setup exponential backoff // 503 retry always, other errors five times $backoffPlugin = new BackoffPlugin(new TruncatedBackoffStrategy( 5, new HttpBackoffStrategy( null, new CurlBackoffStrategy( null, new ExponentialBackoffStrategy() ) ) )); $client->addSubscriber($backoffPlugin); return $client; }
[ "public", "static", "function", "factory", "(", "$", "config", "=", "[", "]", ")", "{", "$", "default", "=", "[", "'url'", "=>", "'https://syrup.keboola.com/gooddata-writer'", "]", ";", "$", "required", "=", "[", "'token'", "]", ";", "$", "config", "=", "Collection", "::", "fromConfig", "(", "$", "config", ",", "$", "default", ",", "$", "required", ")", ";", "$", "config", "[", "'request.options'", "]", "=", "[", "'headers'", "=>", "[", "'X-StorageApi-Token'", "=>", "$", "config", "->", "get", "(", "'token'", ")", "]", ",", "'config'", "=>", "[", "'curl'", "=>", "[", "CURLOPT_HTTP_VERSION", "=>", "CURL_HTTP_VERSION_1_0", "]", "]", "]", ";", "$", "client", "=", "new", "self", "(", "$", "config", "->", "get", "(", "'url'", ")", ",", "$", "config", ")", ";", "// Attach a service description to the client", "$", "description", "=", "ServiceDescription", "::", "factory", "(", "__DIR__", ".", "'/service.json'", ")", ";", "$", "client", "->", "setDescription", "(", "$", "description", ")", ";", "$", "client", "->", "setBaseUrl", "(", "$", "config", "->", "get", "(", "'url'", ")", ")", ";", "// Setup exponential backoff", "// 503 retry always, other errors five times", "$", "backoffPlugin", "=", "new", "BackoffPlugin", "(", "new", "TruncatedBackoffStrategy", "(", "5", ",", "new", "HttpBackoffStrategy", "(", "null", ",", "new", "CurlBackoffStrategy", "(", "null", ",", "new", "ExponentialBackoffStrategy", "(", ")", ")", ")", ")", ")", ";", "$", "client", "->", "addSubscriber", "(", "$", "backoffPlugin", ")", ";", "return", "$", "client", ";", "}" ]
Factory method to create a new Client The following array keys and values are available options: - url: Base URL of web service - token: Storage API token @param array|Collection $config Configuration data @return self
[ "Factory", "method", "to", "create", "a", "new", "Client" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L33-L75
8,151
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createWriter
public function createWriter($writerId, $params = []) { $job = $this->createWriterAsync($writerId, $params); if (!isset($job['url'])) { throw new ServerException('Create writer job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function createWriter($writerId, $params = []) { $job = $this->createWriterAsync($writerId, $params); if (!isset($job['url'])) { throw new ServerException('Create writer job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "createWriter", "(", "$", "writerId", ",", "$", "params", "=", "[", "]", ")", "{", "$", "job", "=", "$", "this", "->", "createWriterAsync", "(", "$", "writerId", ",", "$", "params", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Create writer job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Create writer and wait for finish @param $writerId @param array $params
[ "Create", "writer", "and", "wait", "for", "finish" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L115-L123
8,152
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createWriterWithProjectAsync
public function createWriterWithProjectAsync($writerId, $pid, $username, $password, $params = []) { $params['writerId'] = $writerId; $params['pid'] = $pid; $params['username'] = $username; $params['password'] = $password; return $this->getCommand('CreateWriterWithProject', $params)->execute(); }
php
public function createWriterWithProjectAsync($writerId, $pid, $username, $password, $params = []) { $params['writerId'] = $writerId; $params['pid'] = $pid; $params['username'] = $username; $params['password'] = $password; return $this->getCommand('CreateWriterWithProject', $params)->execute(); }
[ "public", "function", "createWriterWithProjectAsync", "(", "$", "writerId", ",", "$", "pid", ",", "$", "username", ",", "$", "password", ",", "$", "params", "=", "[", "]", ")", "{", "$", "params", "[", "'writerId'", "]", "=", "$", "writerId", ";", "$", "params", "[", "'pid'", "]", "=", "$", "pid", ";", "$", "params", "[", "'username'", "]", "=", "$", "username", ";", "$", "params", "[", "'password'", "]", "=", "$", "password", ";", "return", "$", "this", "->", "getCommand", "(", "'CreateWriterWithProject'", ",", "$", "params", ")", "->", "execute", "(", ")", ";", "}" ]
Create writer with existing GoodData project @param $writerId @param $pid @param $username @param $password @param array $params @return mixed
[ "Create", "writer", "with", "existing", "GoodData", "project" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L134-L142
8,153
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createWriterWithProject
public function createWriterWithProject($writerId, $pid, $username, $password, $params = []) { $job = $this->createWriterWithProjectAsync($writerId, $pid, $username, $password, $params); if (!isset($job['url'])) { throw new ServerException('Create writer job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function createWriterWithProject($writerId, $pid, $username, $password, $params = []) { $job = $this->createWriterWithProjectAsync($writerId, $pid, $username, $password, $params); if (!isset($job['url'])) { throw new ServerException('Create writer job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "createWriterWithProject", "(", "$", "writerId", ",", "$", "pid", ",", "$", "username", ",", "$", "password", ",", "$", "params", "=", "[", "]", ")", "{", "$", "job", "=", "$", "this", "->", "createWriterWithProjectAsync", "(", "$", "writerId", ",", "$", "pid", ",", "$", "username", ",", "$", "password", ",", "$", "params", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Create writer job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Create writer with existing GoodData project and wait for finish @param $writerId @param $pid @param $username @param $password @param array $params @return \Guzzle\Http\Message\RequestInterface @throws ClientException @throws ServerException
[ "Create", "writer", "with", "existing", "GoodData", "project", "and", "wait", "for", "finish" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L155-L163
8,154
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createUserAsync
public function createUserAsync($writerId, $email, $password, $firstName, $lastName, $queue = 'primary') { return $this->getCommand('CreateUser', [ 'writerId' => $writerId, 'email' => $email, 'password' => $password, 'firstName' => $firstName, 'lastName' => $lastName, 'queue' => $queue ])->execute(); }
php
public function createUserAsync($writerId, $email, $password, $firstName, $lastName, $queue = 'primary') { return $this->getCommand('CreateUser', [ 'writerId' => $writerId, 'email' => $email, 'password' => $password, 'firstName' => $firstName, 'lastName' => $lastName, 'queue' => $queue ])->execute(); }
[ "public", "function", "createUserAsync", "(", "$", "writerId", ",", "$", "email", ",", "$", "password", ",", "$", "firstName", ",", "$", "lastName", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'CreateUser'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'email'", "=>", "$", "email", ",", "'password'", "=>", "$", "password", ",", "'firstName'", "=>", "$", "firstName", ",", "'lastName'", "=>", "$", "lastName", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Create user and don't wait for end of the job @param $writerId @param $email @param $password @param $firstName @param $lastName @param string $queue primary|secondary @return mixed
[ "Create", "user", "and", "don", "t", "wait", "for", "end", "of", "the", "job" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L202-L212
8,155
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createUser
public function createUser($writerId, $email, $password, $firstName, $lastName, $queue = 'primary') { $job = $this->createUserAsync($writerId, $email, $password, $firstName, $lastName, $queue); if (!isset($job['url'])) { throw new ServerException('Create user job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } $result = $this->waitForJob($job['url']); if (!isset($result['result'][0]['uid'])) { throw new ServerException('Job info for create user returned unexpected result: ' . json_encode($result, JSON_PRETTY_PRINT)); } return ['uid' => $result['result'][0]['uid']]; }
php
public function createUser($writerId, $email, $password, $firstName, $lastName, $queue = 'primary') { $job = $this->createUserAsync($writerId, $email, $password, $firstName, $lastName, $queue); if (!isset($job['url'])) { throw new ServerException('Create user job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } $result = $this->waitForJob($job['url']); if (!isset($result['result'][0]['uid'])) { throw new ServerException('Job info for create user returned unexpected result: ' . json_encode($result, JSON_PRETTY_PRINT)); } return ['uid' => $result['result'][0]['uid']]; }
[ "public", "function", "createUser", "(", "$", "writerId", ",", "$", "email", ",", "$", "password", ",", "$", "firstName", ",", "$", "lastName", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "createUserAsync", "(", "$", "writerId", ",", "$", "email", ",", "$", "password", ",", "$", "firstName", ",", "$", "lastName", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Create user job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "$", "result", "=", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "if", "(", "!", "isset", "(", "$", "result", "[", "'result'", "]", "[", "0", "]", "[", "'uid'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Job info for create user returned unexpected result: '", ".", "json_encode", "(", "$", "result", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "[", "'uid'", "=>", "$", "result", "[", "'result'", "]", "[", "0", "]", "[", "'uid'", "]", "]", ";", "}" ]
Create user and wait for finish, returns user's uid @param $writerId @param $email @param $password @param $firstName @param $lastName @param string $queue primary|secondary @throws ServerException @return array
[ "Create", "user", "and", "wait", "for", "finish", "returns", "user", "s", "uid" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L225-L238
8,156
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.createProject
public function createProject($writerId, $name = null, $accessToken = null, $queue = 'primary') { $job = $this->createProjectAsync($writerId, $name, $accessToken, $queue); if (!isset($job['url'])) { throw new ServerException('Create project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } $result = $this->waitForJob($job['url']); if (!isset($result['result'][0]['pid'])) { throw new ServerException('Job info for create project returned unexpected result: ' . json_encode($result, JSON_PRETTY_PRINT)); } return ['pid' => $result['result'][0]['pid']]; }
php
public function createProject($writerId, $name = null, $accessToken = null, $queue = 'primary') { $job = $this->createProjectAsync($writerId, $name, $accessToken, $queue); if (!isset($job['url'])) { throw new ServerException('Create project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } $result = $this->waitForJob($job['url']); if (!isset($result['result'][0]['pid'])) { throw new ServerException('Job info for create project returned unexpected result: ' . json_encode($result, JSON_PRETTY_PRINT)); } return ['pid' => $result['result'][0]['pid']]; }
[ "public", "function", "createProject", "(", "$", "writerId", ",", "$", "name", "=", "null", ",", "$", "accessToken", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "createProjectAsync", "(", "$", "writerId", ",", "$", "name", ",", "$", "accessToken", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Create project job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "$", "result", "=", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "if", "(", "!", "isset", "(", "$", "result", "[", "'result'", "]", "[", "0", "]", "[", "'pid'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Job info for create project returned unexpected result: '", ".", "json_encode", "(", "$", "result", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "[", "'pid'", "=>", "$", "result", "[", "'result'", "]", "[", "0", "]", "[", "'pid'", "]", "]", ";", "}" ]
Create project and wait for finish, return project's pid @param $writerId @param $name @param $accessToken @param string $queue primary|secondary @throws ServerException @return array
[ "Create", "project", "and", "wait", "for", "finish", "return", "project", "s", "pid" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L287-L300
8,157
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.getProjectUsers
public function getProjectUsers($writerId, $pid) { $result = $this->getCommand('getProjectUsers', [ 'writerId' => $writerId, 'pid' => $pid ])->execute(); return $result['users']; }
php
public function getProjectUsers($writerId, $pid) { $result = $this->getCommand('getProjectUsers', [ 'writerId' => $writerId, 'pid' => $pid ])->execute(); return $result['users']; }
[ "public", "function", "getProjectUsers", "(", "$", "writerId", ",", "$", "pid", ")", "{", "$", "result", "=", "$", "this", "->", "getCommand", "(", "'getProjectUsers'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'pid'", "=>", "$", "pid", "]", ")", "->", "execute", "(", ")", ";", "return", "$", "result", "[", "'users'", "]", ";", "}" ]
Get list of projects users @param $writerId @param $pid @return mixed
[ "Get", "list", "of", "projects", "users" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L310-L317
8,158
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.addUserToProjectAsync
public function addUserToProjectAsync($writerId, $pid, $email, $role = 'editor', $queue = 'primary') { return $this->getCommand('AddUserToProject', [ 'writerId' => $writerId, 'pid' => $pid, 'email' => $email, 'role' => $role, 'queue' => $queue ])->execute(); }
php
public function addUserToProjectAsync($writerId, $pid, $email, $role = 'editor', $queue = 'primary') { return $this->getCommand('AddUserToProject', [ 'writerId' => $writerId, 'pid' => $pid, 'email' => $email, 'role' => $role, 'queue' => $queue ])->execute(); }
[ "public", "function", "addUserToProjectAsync", "(", "$", "writerId", ",", "$", "pid", ",", "$", "email", ",", "$", "role", "=", "'editor'", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'AddUserToProject'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'pid'", "=>", "$", "pid", ",", "'email'", "=>", "$", "email", ",", "'role'", "=>", "$", "role", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Add user to project @param $writerId @param $pid @param $email @param string $role admin|editor|readOnly|dashboardOnly @param string $queue primary|secondary @return mixed
[ "Add", "user", "to", "project" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L328-L337
8,159
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.addUserToProject
public function addUserToProject($writerId, $pid, $email, $role = 'editor', $queue = 'primary') { $job = $this->addUserToProjectAsync($writerId, $pid, $email, $role, $queue); if (!isset($job['url'])) { throw new ServerException('Create project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function addUserToProject($writerId, $pid, $email, $role = 'editor', $queue = 'primary') { $job = $this->addUserToProjectAsync($writerId, $pid, $email, $role, $queue); if (!isset($job['url'])) { throw new ServerException('Create project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "addUserToProject", "(", "$", "writerId", ",", "$", "pid", ",", "$", "email", ",", "$", "role", "=", "'editor'", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "addUserToProjectAsync", "(", "$", "writerId", ",", "$", "pid", ",", "$", "email", ",", "$", "role", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Create project job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Add user to project and wait for finish @param $writerId @param $pid @param $email @param string $role admin|editor|readOnly|dashboardOnly @param string $queue primary|secondary @throws ServerException @return mixed
[ "Add", "user", "to", "project", "and", "wait", "for", "finish" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L349-L357
8,160
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.getSsoLink
public function getSsoLink($writerId, $pid, $email) { $result = $this->getCommand('GetSSOLink', [ 'writerId' => $writerId, 'pid' => $pid, 'email' => $email ])->execute(); if (!isset($result['ssoLink'])) { throw new ClientException('Getting SSO link failed. ' . (isset($result['error']) ? $result['error'] : '')); } return $result['ssoLink']; }
php
public function getSsoLink($writerId, $pid, $email) { $result = $this->getCommand('GetSSOLink', [ 'writerId' => $writerId, 'pid' => $pid, 'email' => $email ])->execute(); if (!isset($result['ssoLink'])) { throw new ClientException('Getting SSO link failed. ' . (isset($result['error']) ? $result['error'] : '')); } return $result['ssoLink']; }
[ "public", "function", "getSsoLink", "(", "$", "writerId", ",", "$", "pid", ",", "$", "email", ")", "{", "$", "result", "=", "$", "this", "->", "getCommand", "(", "'GetSSOLink'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'pid'", "=>", "$", "pid", ",", "'email'", "=>", "$", "email", "]", ")", "->", "execute", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "result", "[", "'ssoLink'", "]", ")", ")", "{", "throw", "new", "ClientException", "(", "'Getting SSO link failed. '", ".", "(", "isset", "(", "$", "result", "[", "'error'", "]", ")", "?", "$", "result", "[", "'error'", "]", ":", "''", ")", ")", ";", "}", "return", "$", "result", "[", "'ssoLink'", "]", ";", "}" ]
Generate SSO link for configured project and user @param $writerId @param $pid @param $email @throws ClientException @return string
[ "Generate", "SSO", "link", "for", "configured", "project", "and", "user" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L367-L378
8,161
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.updateTable
public function updateTable($writerId, $tableId, $title = null, $export = null, $incrementalLoad = null, $ignoreFilter = null) { $params = [ 'writerId' => $writerId, 'tableId' => $tableId ]; if ($title !== null) { $params['title'] = $title; } if ($export !== null) { $params['export'] = (bool)$export; } if ($incrementalLoad !== null) { $params['incrementalLoad'] = (bool)$incrementalLoad; } if ($ignoreFilter !== null) { $params['ignoreFilter'] = (bool)$ignoreFilter; } return $this->getCommand('UpdateTable', $params)->execute(); }
php
public function updateTable($writerId, $tableId, $title = null, $export = null, $incrementalLoad = null, $ignoreFilter = null) { $params = [ 'writerId' => $writerId, 'tableId' => $tableId ]; if ($title !== null) { $params['title'] = $title; } if ($export !== null) { $params['export'] = (bool)$export; } if ($incrementalLoad !== null) { $params['incrementalLoad'] = (bool)$incrementalLoad; } if ($ignoreFilter !== null) { $params['ignoreFilter'] = (bool)$ignoreFilter; } return $this->getCommand('UpdateTable', $params)->execute(); }
[ "public", "function", "updateTable", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "title", "=", "null", ",", "$", "export", "=", "null", ",", "$", "incrementalLoad", "=", "null", ",", "$", "ignoreFilter", "=", "null", ")", "{", "$", "params", "=", "[", "'writerId'", "=>", "$", "writerId", ",", "'tableId'", "=>", "$", "tableId", "]", ";", "if", "(", "$", "title", "!==", "null", ")", "{", "$", "params", "[", "'title'", "]", "=", "$", "title", ";", "}", "if", "(", "$", "export", "!==", "null", ")", "{", "$", "params", "[", "'export'", "]", "=", "(", "bool", ")", "$", "export", ";", "}", "if", "(", "$", "incrementalLoad", "!==", "null", ")", "{", "$", "params", "[", "'incrementalLoad'", "]", "=", "(", "bool", ")", "$", "incrementalLoad", ";", "}", "if", "(", "$", "ignoreFilter", "!==", "null", ")", "{", "$", "params", "[", "'ignoreFilter'", "]", "=", "(", "bool", ")", "$", "ignoreFilter", ";", "}", "return", "$", "this", "->", "getCommand", "(", "'UpdateTable'", ",", "$", "params", ")", "->", "execute", "(", ")", ";", "}" ]
Update table configuration @param $writerId @param $tableId @param null $title @param null $export @param null $incrementalLoad @param null $ignoreFilter @return mixed
[ "Update", "table", "configuration" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L416-L435
8,162
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.updateTableColumn
public function updateTableColumn($writerId, $tableId, $column, array $configuration) { $allowedConfigurationOptions = ['title', 'type', 'reference', 'schemaReference', 'format', 'dateDimension']; foreach ($configuration as $k => $v) { if (!in_array($k, $allowedConfigurationOptions)) { throw new ClientException("Option '$k' is not allowed, choose from: " . implode(', ', $allowedConfigurationOptions)); } } $params = [ 'writerId' => $writerId, 'tableId' => $tableId, 'column' => $column ]; $params = array_merge($params, $configuration); return $this->getCommand('UpdateTableColumn', $params)->execute(); }
php
public function updateTableColumn($writerId, $tableId, $column, array $configuration) { $allowedConfigurationOptions = ['title', 'type', 'reference', 'schemaReference', 'format', 'dateDimension']; foreach ($configuration as $k => $v) { if (!in_array($k, $allowedConfigurationOptions)) { throw new ClientException("Option '$k' is not allowed, choose from: " . implode(', ', $allowedConfigurationOptions)); } } $params = [ 'writerId' => $writerId, 'tableId' => $tableId, 'column' => $column ]; $params = array_merge($params, $configuration); return $this->getCommand('UpdateTableColumn', $params)->execute(); }
[ "public", "function", "updateTableColumn", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "column", ",", "array", "$", "configuration", ")", "{", "$", "allowedConfigurationOptions", "=", "[", "'title'", ",", "'type'", ",", "'reference'", ",", "'schemaReference'", ",", "'format'", ",", "'dateDimension'", "]", ";", "foreach", "(", "$", "configuration", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "in_array", "(", "$", "k", ",", "$", "allowedConfigurationOptions", ")", ")", "{", "throw", "new", "ClientException", "(", "\"Option '$k' is not allowed, choose from: \"", ".", "implode", "(", "', '", ",", "$", "allowedConfigurationOptions", ")", ")", ";", "}", "}", "$", "params", "=", "[", "'writerId'", "=>", "$", "writerId", ",", "'tableId'", "=>", "$", "tableId", ",", "'column'", "=>", "$", "column", "]", ";", "$", "params", "=", "array_merge", "(", "$", "params", ",", "$", "configuration", ")", ";", "return", "$", "this", "->", "getCommand", "(", "'UpdateTableColumn'", ",", "$", "params", ")", "->", "execute", "(", ")", ";", "}" ]
Update table column configuration @param $writerId @param $tableId @param $column @param array $configuration Array with keys: [title, type, reference, schemaReference, format, dateDimension] @throws ClientException @return mixed
[ "Update", "table", "column", "configuration" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L446-L462
8,163
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.updateTableColumns
public function updateTableColumns($writerId, $tableId, array $columns) { $allowedConfigurationOptions = ['name', 'title', 'type', 'reference', 'schemaReference', 'format', 'dateDimension']; foreach ($columns as $column) { if (!isset($column['name'])) { throw new ClientException("One of the columns is missing 'name' parameter"); } foreach ($column as $k => $v) { if (!in_array($k, $allowedConfigurationOptions)) { throw new ClientException("Option '$k' for column '$column' is not allowed, choose from: " . implode(', ', $allowedConfigurationOptions)); } } } $params = [ 'writerId' => $writerId, 'tableId' => $tableId, 'columns' => $columns ]; return $this->getCommand('UpdateTableColumns', $params)->execute(); }
php
public function updateTableColumns($writerId, $tableId, array $columns) { $allowedConfigurationOptions = ['name', 'title', 'type', 'reference', 'schemaReference', 'format', 'dateDimension']; foreach ($columns as $column) { if (!isset($column['name'])) { throw new ClientException("One of the columns is missing 'name' parameter"); } foreach ($column as $k => $v) { if (!in_array($k, $allowedConfigurationOptions)) { throw new ClientException("Option '$k' for column '$column' is not allowed, choose from: " . implode(', ', $allowedConfigurationOptions)); } } } $params = [ 'writerId' => $writerId, 'tableId' => $tableId, 'columns' => $columns ]; return $this->getCommand('UpdateTableColumns', $params)->execute(); }
[ "public", "function", "updateTableColumns", "(", "$", "writerId", ",", "$", "tableId", ",", "array", "$", "columns", ")", "{", "$", "allowedConfigurationOptions", "=", "[", "'name'", ",", "'title'", ",", "'type'", ",", "'reference'", ",", "'schemaReference'", ",", "'format'", ",", "'dateDimension'", "]", ";", "foreach", "(", "$", "columns", "as", "$", "column", ")", "{", "if", "(", "!", "isset", "(", "$", "column", "[", "'name'", "]", ")", ")", "{", "throw", "new", "ClientException", "(", "\"One of the columns is missing 'name' parameter\"", ")", ";", "}", "foreach", "(", "$", "column", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "in_array", "(", "$", "k", ",", "$", "allowedConfigurationOptions", ")", ")", "{", "throw", "new", "ClientException", "(", "\"Option '$k' for column '$column' is not allowed, choose from: \"", ".", "implode", "(", "', '", ",", "$", "allowedConfigurationOptions", ")", ")", ";", "}", "}", "}", "$", "params", "=", "[", "'writerId'", "=>", "$", "writerId", ",", "'tableId'", "=>", "$", "tableId", ",", "'columns'", "=>", "$", "columns", "]", ";", "return", "$", "this", "->", "getCommand", "(", "'UpdateTableColumns'", ",", "$", "params", ")", "->", "execute", "(", ")", ";", "}" ]
Update table columns configuration @param $writerId @param $tableId @param array $columns Array of arrays with keys: [name, title, type, reference, schemaReference, format, dateDimension] @throws ClientException @return mixed
[ "Update", "table", "columns", "configuration" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L472-L492
8,164
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.uploadProjectAsync
public function uploadProjectAsync($writerId, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('UploadProject', [ 'writerId' => $writerId, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
php
public function uploadProjectAsync($writerId, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('UploadProject', [ 'writerId' => $writerId, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
[ "public", "function", "uploadProjectAsync", "(", "$", "writerId", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'UploadProject'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'incrementalLoad'", "=>", "$", "incrementalLoad", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Upload project to GoodData @param $writerId @param null $incrementalLoad @param string $queue @return mixed
[ "Upload", "project", "to", "GoodData" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L502-L509
8,165
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.uploadProject
public function uploadProject($writerId, $incrementalLoad = null, $queue = 'primary') { $job = $this->uploadProjectAsync($writerId, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Upload project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function uploadProject($writerId, $incrementalLoad = null, $queue = 'primary') { $job = $this->uploadProjectAsync($writerId, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Upload project job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "uploadProject", "(", "$", "writerId", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "uploadProjectAsync", "(", "$", "writerId", ",", "$", "incrementalLoad", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Upload project job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Upload project to GoodData and wait for result @param $writerId @param null $incrementalLoad @param string $queue @throws ServerException @return mixed
[ "Upload", "project", "to", "GoodData", "and", "wait", "for", "result" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L519-L527
8,166
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.uploadTableAsync
public function uploadTableAsync($writerId, $tableId, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('UploadTable', [ 'writerId' => $writerId, 'tableId' => $tableId, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
php
public function uploadTableAsync($writerId, $tableId, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('UploadTable', [ 'writerId' => $writerId, 'tableId' => $tableId, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
[ "public", "function", "uploadTableAsync", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'UploadTable'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'tableId'", "=>", "$", "tableId", ",", "'incrementalLoad'", "=>", "$", "incrementalLoad", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Upload table to GoodData @param $writerId @param $tableId @param null $incrementalLoad @param string $queue @return mixed
[ "Upload", "table", "to", "GoodData" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L537-L545
8,167
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.uploadTable
public function uploadTable($writerId, $tableId, $incrementalLoad = null, $queue = 'primary') { $job = $this->uploadTableAsync($writerId, $tableId, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Upload table job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function uploadTable($writerId, $tableId, $incrementalLoad = null, $queue = 'primary') { $job = $this->uploadTableAsync($writerId, $tableId, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Upload table job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "uploadTable", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "uploadTableAsync", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "incrementalLoad", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Upload table job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Upload table to GoodData and wait for result @param $writerId @param $tableId @param null $incrementalLoad @param string $queue @throws ServerException @return mixed
[ "Upload", "table", "to", "GoodData", "and", "wait", "for", "result" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L556-L564
8,168
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.updateModelAsync
public function updateModelAsync($writerId, $tableId, $queue = 'primary') { return $this->getCommand('UpdateModel', [ 'writerId' => $writerId, 'tableId' => $tableId, 'queue' => $queue ])->execute(); }
php
public function updateModelAsync($writerId, $tableId, $queue = 'primary') { return $this->getCommand('UpdateModel', [ 'writerId' => $writerId, 'tableId' => $tableId, 'queue' => $queue ])->execute(); }
[ "public", "function", "updateModelAsync", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'UpdateModel'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'tableId'", "=>", "$", "tableId", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Update model of table in GoodData @param $writerId @param $tableId @param string $queue @return mixed
[ "Update", "model", "of", "table", "in", "GoodData" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L573-L580
8,169
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.updateModel
public function updateModel($writerId, $tableId, $queue = 'primary') { $job = $this->updateModelAsync($writerId, $tableId, $queue); if (!isset($job['url'])) { throw new ServerException('Update model job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function updateModel($writerId, $tableId, $queue = 'primary') { $job = $this->updateModelAsync($writerId, $tableId, $queue); if (!isset($job['url'])) { throw new ServerException('Update model job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "updateModel", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "updateModelAsync", "(", "$", "writerId", ",", "$", "tableId", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Update model job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Update model of table in GoodData and wait for result @param $writerId @param $tableId @param string $queue @throws ServerException @return mixed
[ "Update", "model", "of", "table", "in", "GoodData", "and", "wait", "for", "result" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L590-L598
8,170
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.loadDataAsync
public function loadDataAsync($writerId, array $tables, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('LoadData', [ 'writerId' => $writerId, 'tables' => $tables, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
php
public function loadDataAsync($writerId, array $tables, $incrementalLoad = null, $queue = 'primary') { return $this->getCommand('LoadData', [ 'writerId' => $writerId, 'tables' => $tables, 'incrementalLoad' => $incrementalLoad, 'queue' => $queue ])->execute(); }
[ "public", "function", "loadDataAsync", "(", "$", "writerId", ",", "array", "$", "tables", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "return", "$", "this", "->", "getCommand", "(", "'LoadData'", ",", "[", "'writerId'", "=>", "$", "writerId", ",", "'tables'", "=>", "$", "tables", ",", "'incrementalLoad'", "=>", "$", "incrementalLoad", ",", "'queue'", "=>", "$", "queue", "]", ")", "->", "execute", "(", ")", ";", "}" ]
Load data to table in GoodData @param $writerId @param array $tables @param null $incrementalLoad @param string $queue @return mixed
[ "Load", "data", "to", "table", "in", "GoodData" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L608-L616
8,171
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.loadData
public function loadData($writerId, array $tables, $incrementalLoad = null, $queue = 'primary') { $job = $this->loadDataAsync($writerId, $tables, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Load data job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
php
public function loadData($writerId, array $tables, $incrementalLoad = null, $queue = 'primary') { $job = $this->loadDataAsync($writerId, $tables, $incrementalLoad, $queue); if (!isset($job['url'])) { throw new ServerException('Load data job returned unexpected result: ' . json_encode($job, JSON_PRETTY_PRINT)); } return $this->waitForJob($job['url']); }
[ "public", "function", "loadData", "(", "$", "writerId", ",", "array", "$", "tables", ",", "$", "incrementalLoad", "=", "null", ",", "$", "queue", "=", "'primary'", ")", "{", "$", "job", "=", "$", "this", "->", "loadDataAsync", "(", "$", "writerId", ",", "$", "tables", ",", "$", "incrementalLoad", ",", "$", "queue", ")", ";", "if", "(", "!", "isset", "(", "$", "job", "[", "'url'", "]", ")", ")", "{", "throw", "new", "ServerException", "(", "'Load data job returned unexpected result: '", ".", "json_encode", "(", "$", "job", ",", "JSON_PRETTY_PRINT", ")", ")", ";", "}", "return", "$", "this", "->", "waitForJob", "(", "$", "job", "[", "'url'", "]", ")", ";", "}" ]
Load data to table in GoodData and wait for result @param $writerId @param array $tables @param null $incrementalLoad @param string $queue @throws ServerException @return mixed
[ "Load", "data", "to", "table", "in", "GoodData", "and", "wait", "for", "result" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L627-L635
8,172
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.getJobs
public function getJobs($writerId, $since = null, $until = null) { $url = parse_url($this->getBaseUrl()); $componentName = substr($url['path'], 1); $url = "https://{$url['host']}/queue/jobs?component={$componentName}&q=params.writerId={$writerId}"; if ($since) { $url .= '&since=' . urlencode($since); } if ($until) { $url .= '&until=' . urlencode($until); } return $this->get($url)->send()->json(); }
php
public function getJobs($writerId, $since = null, $until = null) { $url = parse_url($this->getBaseUrl()); $componentName = substr($url['path'], 1); $url = "https://{$url['host']}/queue/jobs?component={$componentName}&q=params.writerId={$writerId}"; if ($since) { $url .= '&since=' . urlencode($since); } if ($until) { $url .= '&until=' . urlencode($until); } return $this->get($url)->send()->json(); }
[ "public", "function", "getJobs", "(", "$", "writerId", ",", "$", "since", "=", "null", ",", "$", "until", "=", "null", ")", "{", "$", "url", "=", "parse_url", "(", "$", "this", "->", "getBaseUrl", "(", ")", ")", ";", "$", "componentName", "=", "substr", "(", "$", "url", "[", "'path'", "]", ",", "1", ")", ";", "$", "url", "=", "\"https://{$url['host']}/queue/jobs?component={$componentName}&q=params.writerId={$writerId}\"", ";", "if", "(", "$", "since", ")", "{", "$", "url", ".=", "'&since='", ".", "urlencode", "(", "$", "since", ")", ";", "}", "if", "(", "$", "until", ")", "{", "$", "url", ".=", "'&until='", ".", "urlencode", "(", "$", "until", ")", ";", "}", "return", "$", "this", "->", "get", "(", "$", "url", ")", "->", "send", "(", ")", "->", "json", "(", ")", ";", "}" ]
Return list of jobs for given writerId @param $writerId @param null $since @param null $until @return mixed
[ "Return", "list", "of", "jobs", "for", "given", "writerId" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L645-L657
8,173
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.getJob
public function getJob($jobId) { $url = parse_url($this->getBaseUrl()); return $this->get("https://{$url['host']}/queue/job/{$jobId}")->send()->json(); }
php
public function getJob($jobId) { $url = parse_url($this->getBaseUrl()); return $this->get("https://{$url['host']}/queue/job/{$jobId}")->send()->json(); }
[ "public", "function", "getJob", "(", "$", "jobId", ")", "{", "$", "url", "=", "parse_url", "(", "$", "this", "->", "getBaseUrl", "(", ")", ")", ";", "return", "$", "this", "->", "get", "(", "\"https://{$url['host']}/queue/job/{$jobId}\"", ")", "->", "send", "(", ")", "->", "json", "(", ")", ";", "}" ]
Return detail of given job @param $jobId @return mixed
[ "Return", "detail", "of", "given", "job" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L664-L668
8,174
keboola/gooddata-writer-php-client
src/Keboola/Writer/GoodData/Client.php
Client.waitForJob
public function waitForJob($url) { $jobFinished = false; $i = 1; do { $jobInfo = $jobInfo = $this->get($url)->send()->json(); if (isset($jobInfo['status']) && !in_array($jobInfo['status'], ['waiting', 'processing'])) { $jobFinished = true; } if (!$jobFinished) { usleep((1 << $i) * 1000000 + rand(0, 1000000)); } $i++; } while (!$jobFinished); return $jobInfo; }
php
public function waitForJob($url) { $jobFinished = false; $i = 1; do { $jobInfo = $jobInfo = $this->get($url)->send()->json(); if (isset($jobInfo['status']) && !in_array($jobInfo['status'], ['waiting', 'processing'])) { $jobFinished = true; } if (!$jobFinished) { usleep((1 << $i) * 1000000 + rand(0, 1000000)); } $i++; } while (!$jobFinished); return $jobInfo; }
[ "public", "function", "waitForJob", "(", "$", "url", ")", "{", "$", "jobFinished", "=", "false", ";", "$", "i", "=", "1", ";", "do", "{", "$", "jobInfo", "=", "$", "jobInfo", "=", "$", "this", "->", "get", "(", "$", "url", ")", "->", "send", "(", ")", "->", "json", "(", ")", ";", "if", "(", "isset", "(", "$", "jobInfo", "[", "'status'", "]", ")", "&&", "!", "in_array", "(", "$", "jobInfo", "[", "'status'", "]", ",", "[", "'waiting'", ",", "'processing'", "]", ")", ")", "{", "$", "jobFinished", "=", "true", ";", "}", "if", "(", "!", "$", "jobFinished", ")", "{", "usleep", "(", "(", "1", "<<", "$", "i", ")", "*", "1000000", "+", "rand", "(", "0", ",", "1000000", ")", ")", ";", "}", "$", "i", "++", ";", "}", "while", "(", "!", "$", "jobFinished", ")", ";", "return", "$", "jobInfo", ";", "}" ]
Ask repeatedly for job status until it is finished @param $url @return array
[ "Ask", "repeatedly", "for", "job", "status", "until", "it", "is", "finished" ]
cee4bc31fa840db788f740ae1fce29cc4f73c2b0
https://github.com/keboola/gooddata-writer-php-client/blob/cee4bc31fa840db788f740ae1fce29cc4f73c2b0/src/Keboola/Writer/GoodData/Client.php#L676-L692
8,175
GustavSoftware/Utils
src/Log/LogException.php
LogException.unknownLogger
public static function unknownLogger( string $name, \Exception $previous = null ): self { return new self( "could not find logger \"{$name}\"", self::UNKNOWN_LOGGER, $previous ); }
php
public static function unknownLogger( string $name, \Exception $previous = null ): self { return new self( "could not find logger \"{$name}\"", self::UNKNOWN_LOGGER, $previous ); }
[ "public", "static", "function", "unknownLogger", "(", "string", "$", "name", ",", "\\", "Exception", "$", "previous", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "\"could not find logger \\\"{$name}\\\"\"", ",", "self", "::", "UNKNOWN_LOGGER", ",", "$", "previous", ")", ";", "}" ]
Creates an exception if the logger with the given name could not be found by the log manager. @param string $name The logger's identifying name @param \Exception|null $previous Previous exception @return \Gustav\Utils\Log\LogException The exception
[ "Creates", "an", "exception", "if", "the", "logger", "with", "the", "given", "name", "could", "not", "be", "found", "by", "the", "log", "manager", "." ]
370131e9baf3477863123ca31972cbbfaaf2f39b
https://github.com/GustavSoftware/Utils/blob/370131e9baf3477863123ca31972cbbfaaf2f39b/src/Log/LogException.php#L78-L87
8,176
GustavSoftware/Utils
src/Log/LogException.php
LogException.invalidFileName
public static function invalidFileName( string $fileName, \Exception $previous = null ): self { return new self( "invalid log file \"{$fileName}\"", self::INVALID_FILENAME, $previous ); }
php
public static function invalidFileName( string $fileName, \Exception $previous = null ): self { return new self( "invalid log file \"{$fileName}\"", self::INVALID_FILENAME, $previous ); }
[ "public", "static", "function", "invalidFileName", "(", "string", "$", "fileName", ",", "\\", "Exception", "$", "previous", "=", "null", ")", ":", "self", "{", "return", "new", "self", "(", "\"invalid log file \\\"{$fileName}\\\"\"", ",", "self", "::", "INVALID_FILENAME", ",", "$", "previous", ")", ";", "}" ]
Creates an exception if an invalid file name was set in configuration of a file logger. @param string $fileName The file name @param \Exception|null $previous Previous exception @return \Gustav\Utils\Log\LogException The exception
[ "Creates", "an", "exception", "if", "an", "invalid", "file", "name", "was", "set", "in", "configuration", "of", "a", "file", "logger", "." ]
370131e9baf3477863123ca31972cbbfaaf2f39b
https://github.com/GustavSoftware/Utils/blob/370131e9baf3477863123ca31972cbbfaaf2f39b/src/Log/LogException.php#L100-L109
8,177
chigix/chiji-frontend
src/Util/CacheManager.php
CacheManager.searchCacheDir
public function searchCacheDir(File $origDir) { if (isset($this->autoDirPathMap[\md5($origDir->getAbsolutePath())])) { $entry = $this->autoDirPathMap[\md5($origDir->getAbsolutePath())]; return $entry[1]; } else { return null; } }
php
public function searchCacheDir(File $origDir) { if (isset($this->autoDirPathMap[\md5($origDir->getAbsolutePath())])) { $entry = $this->autoDirPathMap[\md5($origDir->getAbsolutePath())]; return $entry[1]; } else { return null; } }
[ "public", "function", "searchCacheDir", "(", "File", "$", "origDir", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "autoDirPathMap", "[", "\\", "md5", "(", "$", "origDir", "->", "getAbsolutePath", "(", ")", ")", "]", ")", ")", "{", "$", "entry", "=", "$", "this", "->", "autoDirPathMap", "[", "\\", "md5", "(", "$", "origDir", "->", "getAbsolutePath", "(", ")", ")", "]", ";", "return", "$", "entry", "[", "1", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Search the cache directory by mapping original directory @param File $origDir @return File
[ "Search", "the", "cache", "directory", "by", "mapping", "original", "directory" ]
5407f98c21ee99f8bbef43c97a231c0f81ed3e74
https://github.com/chigix/chiji-frontend/blob/5407f98c21ee99f8bbef43c97a231c0f81ed3e74/src/Util/CacheManager.php#L151-L158
8,178
chigix/chiji-frontend
src/Util/CacheManager.php
CacheManager.searchOrigDir
public function searchOrigDir(File $cacheDir) { foreach ($this->autoDirPathMap as $entry_set) { $orig_dir = $entry_set[0]; $cache_dir = $entry_set[1]; if ($cacheDir->getAbsolutePath() === $cache_dir->getAbsolutePath()) { return $orig_dir; } } return null; }
php
public function searchOrigDir(File $cacheDir) { foreach ($this->autoDirPathMap as $entry_set) { $orig_dir = $entry_set[0]; $cache_dir = $entry_set[1]; if ($cacheDir->getAbsolutePath() === $cache_dir->getAbsolutePath()) { return $orig_dir; } } return null; }
[ "public", "function", "searchOrigDir", "(", "File", "$", "cacheDir", ")", "{", "foreach", "(", "$", "this", "->", "autoDirPathMap", "as", "$", "entry_set", ")", "{", "$", "orig_dir", "=", "$", "entry_set", "[", "0", "]", ";", "$", "cache_dir", "=", "$", "entry_set", "[", "1", "]", ";", "if", "(", "$", "cacheDir", "->", "getAbsolutePath", "(", ")", "===", "$", "cache_dir", "->", "getAbsolutePath", "(", ")", ")", "{", "return", "$", "orig_dir", ";", "}", "}", "return", "null", ";", "}" ]
Search the original directory by mapping cached directory @param File $cacheDir @return File
[ "Search", "the", "original", "directory", "by", "mapping", "cached", "directory" ]
5407f98c21ee99f8bbef43c97a231c0f81ed3e74
https://github.com/chigix/chiji-frontend/blob/5407f98c21ee99f8bbef43c97a231c0f81ed3e74/src/Util/CacheManager.php#L166-L175
8,179
Trellmor/php-framework
Application/Route.php
Route.matchUrl
public function matchUrl($method, $url) { if ($this->method == $method) { if (preg_match('/^' . $this->url . '$/', $url, $matches)) { $params = $this->prepareParams($matches); $this->execute($params); return true; } return false; } }
php
public function matchUrl($method, $url) { if ($this->method == $method) { if (preg_match('/^' . $this->url . '$/', $url, $matches)) { $params = $this->prepareParams($matches); $this->execute($params); return true; } return false; } }
[ "public", "function", "matchUrl", "(", "$", "method", ",", "$", "url", ")", "{", "if", "(", "$", "this", "->", "method", "==", "$", "method", ")", "{", "if", "(", "preg_match", "(", "'/^'", ".", "$", "this", "->", "url", ".", "'$/'", ",", "$", "url", ",", "$", "matches", ")", ")", "{", "$", "params", "=", "$", "this", "->", "prepareParams", "(", "$", "matches", ")", ";", "$", "this", "->", "execute", "(", "$", "params", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}" ]
Checks if the passed url matches the route. If it maches the class will be created and the function called with the arguments extracted from the url
[ "Checks", "if", "the", "passed", "url", "matches", "the", "route", ".", "If", "it", "maches", "the", "class", "will", "be", "created", "and", "the", "function", "called", "with", "the", "arguments", "extracted", "from", "the", "url" ]
5fda0dd52e0bc3ac4e0ed3b26125739904b2201e
https://github.com/Trellmor/php-framework/blob/5fda0dd52e0bc3ac4e0ed3b26125739904b2201e/Application/Route.php#L72-L81
8,180
adilab/css
src/Css/Css.php
Css.remove
public function remove($property) { $property = trim(strtolower($property)); unset($this->css[$property]); return $this; }
php
public function remove($property) { $property = trim(strtolower($property)); unset($this->css[$property]); return $this; }
[ "public", "function", "remove", "(", "$", "property", ")", "{", "$", "property", "=", "trim", "(", "strtolower", "(", "$", "property", ")", ")", ";", "unset", "(", "$", "this", "->", "css", "[", "$", "property", "]", ")", ";", "return", "$", "this", ";", "}" ]
Removes CSS property. <code> $css->remove('width'); </code> @param string $property @return Css
[ "Removes", "CSS", "property", "." ]
b24d745f383c371e0233b1dcf3b35f7d7fc18293
https://github.com/adilab/css/blob/b24d745f383c371e0233b1dcf3b35f7d7fc18293/src/Css/Css.php#L60-L67
8,181
adilab/css
src/Css/Css.php
Css.set
public function set($css, $value = NULL) { $css = trim(strtolower($css)); if (func_num_args() == 1) { $elements = explode(';', $css); foreach ($elements as $element) { if (!$element = trim($element)) { continue; } $element = explode(':', $element); if (!$element[0] = trim(@$element[0])) { continue; } $element[1] = trim(@$element[1]); $this->set($element[0], $element[1]); } return; } $css = strtolower($css); $this->css[$css] = $value; return $this; }
php
public function set($css, $value = NULL) { $css = trim(strtolower($css)); if (func_num_args() == 1) { $elements = explode(';', $css); foreach ($elements as $element) { if (!$element = trim($element)) { continue; } $element = explode(':', $element); if (!$element[0] = trim(@$element[0])) { continue; } $element[1] = trim(@$element[1]); $this->set($element[0], $element[1]); } return; } $css = strtolower($css); $this->css[$css] = $value; return $this; }
[ "public", "function", "set", "(", "$", "css", ",", "$", "value", "=", "NULL", ")", "{", "$", "css", "=", "trim", "(", "strtolower", "(", "$", "css", ")", ")", ";", "if", "(", "func_num_args", "(", ")", "==", "1", ")", "{", "$", "elements", "=", "explode", "(", "';'", ",", "$", "css", ")", ";", "foreach", "(", "$", "elements", "as", "$", "element", ")", "{", "if", "(", "!", "$", "element", "=", "trim", "(", "$", "element", ")", ")", "{", "continue", ";", "}", "$", "element", "=", "explode", "(", "':'", ",", "$", "element", ")", ";", "if", "(", "!", "$", "element", "[", "0", "]", "=", "trim", "(", "@", "$", "element", "[", "0", "]", ")", ")", "{", "continue", ";", "}", "$", "element", "[", "1", "]", "=", "trim", "(", "@", "$", "element", "[", "1", "]", ")", ";", "$", "this", "->", "set", "(", "$", "element", "[", "0", "]", ",", "$", "element", "[", "1", "]", ")", ";", "}", "return", ";", "}", "$", "css", "=", "strtolower", "(", "$", "css", ")", ";", "$", "this", "->", "css", "[", "$", "css", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Sets CSS value. <code> $css->set('width: 20px'); $css->set('color', '#ff0000'); </code> @param mixed $css CSS property or CSS expression string @param string $value @return Css
[ "Sets", "CSS", "value", "." ]
b24d745f383c371e0233b1dcf3b35f7d7fc18293
https://github.com/adilab/css/blob/b24d745f383c371e0233b1dcf3b35f7d7fc18293/src/Css/Css.php#L82-L114
8,182
adilab/css
src/Css/Css.php
Css.render
public function render() { $result = NULL; foreach ($this->css as $name => $value) { if (!$value = trim($value)) { continue; } $result .= "{$name}:{$value};"; } return $result ? $result : ''; }
php
public function render() { $result = NULL; foreach ($this->css as $name => $value) { if (!$value = trim($value)) { continue; } $result .= "{$name}:{$value};"; } return $result ? $result : ''; }
[ "public", "function", "render", "(", ")", "{", "$", "result", "=", "NULL", ";", "foreach", "(", "$", "this", "->", "css", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "!", "$", "value", "=", "trim", "(", "$", "value", ")", ")", "{", "continue", ";", "}", "$", "result", ".=", "\"{$name}:{$value};\"", ";", "}", "return", "$", "result", "?", "$", "result", ":", "''", ";", "}" ]
Creates CSS string @return string
[ "Creates", "CSS", "string" ]
b24d745f383c371e0233b1dcf3b35f7d7fc18293
https://github.com/adilab/css/blob/b24d745f383c371e0233b1dcf3b35f7d7fc18293/src/Css/Css.php#L135-L149
8,183
chanhong/mvclite
src/Util.php
Util.escapeStr
public static function escapeStr($inp) { if (is_array($inp)) { return array_map(__METHOD__, $inp); // use call back to itself to replace when it is array } if (!empty($inp) && is_string($inp)) { $badchr = array( "\xc2", // prefix 1 "\x80", // prefix 2 "\x98", // single quote opening "\x99", // single quote closing "\x8c", // double quote opening "\x9d", // double quote closing "\x96", // En dash "\x97" // Em dash ); $goodchr = array('', '', '\'', '\'', '"', '"', '-', '-'); $inp = str_replace($badchr, $goodchr, $inp); } return $inp; }
php
public static function escapeStr($inp) { if (is_array($inp)) { return array_map(__METHOD__, $inp); // use call back to itself to replace when it is array } if (!empty($inp) && is_string($inp)) { $badchr = array( "\xc2", // prefix 1 "\x80", // prefix 2 "\x98", // single quote opening "\x99", // single quote closing "\x8c", // double quote opening "\x9d", // double quote closing "\x96", // En dash "\x97" // Em dash ); $goodchr = array('', '', '\'', '\'', '"', '"', '-', '-'); $inp = str_replace($badchr, $goodchr, $inp); } return $inp; }
[ "public", "static", "function", "escapeStr", "(", "$", "inp", ")", "{", "if", "(", "is_array", "(", "$", "inp", ")", ")", "{", "return", "array_map", "(", "__METHOD__", ",", "$", "inp", ")", ";", "// use call back to itself to replace when it is array", "}", "if", "(", "!", "empty", "(", "$", "inp", ")", "&&", "is_string", "(", "$", "inp", ")", ")", "{", "$", "badchr", "=", "array", "(", "\"\\xc2\"", ",", "// prefix 1", "\"\\x80\"", ",", "// prefix 2", "\"\\x98\"", ",", "// single quote opening", "\"\\x99\"", ",", "// single quote closing", "\"\\x8c\"", ",", "// double quote opening", "\"\\x9d\"", ",", "// double quote closing", "\"\\x96\"", ",", "// En dash", "\"\\x97\"", "// Em dash", ")", ";", "$", "goodchr", "=", "array", "(", "''", ",", "''", ",", "'\\''", ",", "'\\''", ",", "'\"'", ",", "'\"'", ",", "'-'", ",", "'-'", ")", ";", "$", "inp", "=", "str_replace", "(", "$", "badchr", ",", "$", "goodchr", ",", "$", "inp", ")", ";", "}", "return", "$", "inp", ";", "}" ]
must test this
[ "must", "test", "this" ]
31c52ebf9c435705a3ed9a2e00cebc32705c35f5
https://github.com/chanhong/mvclite/blob/31c52ebf9c435705a3ed9a2e00cebc32705c35f5/src/Util.php#L504-L524
8,184
mizzencms/core
src/EventManager.php
EventManager.attach
public function attach(ObserverInterface $observer) { $observers = $this->getObservers(); foreach ($observer->getEvents() as $event) { $observers[$event][] = $observer; } $this->setObservers($observers); }
php
public function attach(ObserverInterface $observer) { $observers = $this->getObservers(); foreach ($observer->getEvents() as $event) { $observers[$event][] = $observer; } $this->setObservers($observers); }
[ "public", "function", "attach", "(", "ObserverInterface", "$", "observer", ")", "{", "$", "observers", "=", "$", "this", "->", "getObservers", "(", ")", ";", "foreach", "(", "$", "observer", "->", "getEvents", "(", ")", "as", "$", "event", ")", "{", "$", "observers", "[", "$", "event", "]", "[", "]", "=", "$", "observer", ";", "}", "$", "this", "->", "setObservers", "(", "$", "observers", ")", ";", "}" ]
Method responsible for adding observers to event manager @todo fail if observer has no events @param ObserverInterface $observer
[ "Method", "responsible", "for", "adding", "observers", "to", "event", "manager" ]
d4efb4d1af7f3948fa7bee43d54298c6164ac5bb
https://github.com/mizzencms/core/blob/d4efb4d1af7f3948fa7bee43d54298c6164ac5bb/src/EventManager.php#L26-L35
8,185
mizzencms/core
src/EventManager.php
EventManager.detach
public function detach(ObserverInterface $observer) { $observers = $this->getObservers(); foreach ($observer->getEvents() as $event) { $count = count($observers[$event]); for ($i = 0; $i < $count; $i++) { if ($observers[$event][$i] == $observer) { unset($observers[$event][$i]); } } } $this->setObservers($observers); }
php
public function detach(ObserverInterface $observer) { $observers = $this->getObservers(); foreach ($observer->getEvents() as $event) { $count = count($observers[$event]); for ($i = 0; $i < $count; $i++) { if ($observers[$event][$i] == $observer) { unset($observers[$event][$i]); } } } $this->setObservers($observers); }
[ "public", "function", "detach", "(", "ObserverInterface", "$", "observer", ")", "{", "$", "observers", "=", "$", "this", "->", "getObservers", "(", ")", ";", "foreach", "(", "$", "observer", "->", "getEvents", "(", ")", "as", "$", "event", ")", "{", "$", "count", "=", "count", "(", "$", "observers", "[", "$", "event", "]", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "count", ";", "$", "i", "++", ")", "{", "if", "(", "$", "observers", "[", "$", "event", "]", "[", "$", "i", "]", "==", "$", "observer", ")", "{", "unset", "(", "$", "observers", "[", "$", "event", "]", "[", "$", "i", "]", ")", ";", "}", "}", "}", "$", "this", "->", "setObservers", "(", "$", "observers", ")", ";", "}" ]
Method responsible for removing observers from event manager @param ObserverInterface $observer
[ "Method", "responsible", "for", "removing", "observers", "from", "event", "manager" ]
d4efb4d1af7f3948fa7bee43d54298c6164ac5bb
https://github.com/mizzencms/core/blob/d4efb4d1af7f3948fa7bee43d54298c6164ac5bb/src/EventManager.php#L40-L55
8,186
mizzencms/core
src/EventManager.php
EventManager.notify
public function notify($event, $params) { $observers = $this->getObservers(); if (isset($observers[$event])) { foreach ($observers[$event] as $observer) { $observer->setTriggeredEvent($event); $observer->setTriggeredEventParams($params); $observer->setBag($this->getBag()); $observer->run(); } } }
php
public function notify($event, $params) { $observers = $this->getObservers(); if (isset($observers[$event])) { foreach ($observers[$event] as $observer) { $observer->setTriggeredEvent($event); $observer->setTriggeredEventParams($params); $observer->setBag($this->getBag()); $observer->run(); } } }
[ "public", "function", "notify", "(", "$", "event", ",", "$", "params", ")", "{", "$", "observers", "=", "$", "this", "->", "getObservers", "(", ")", ";", "if", "(", "isset", "(", "$", "observers", "[", "$", "event", "]", ")", ")", "{", "foreach", "(", "$", "observers", "[", "$", "event", "]", "as", "$", "observer", ")", "{", "$", "observer", "->", "setTriggeredEvent", "(", "$", "event", ")", ";", "$", "observer", "->", "setTriggeredEventParams", "(", "$", "params", ")", ";", "$", "observer", "->", "setBag", "(", "$", "this", "->", "getBag", "(", ")", ")", ";", "$", "observer", "->", "run", "(", ")", ";", "}", "}", "}" ]
Method responsible for notifying observers upon event trigger @param string $event @param array $params
[ "Method", "responsible", "for", "notifying", "observers", "upon", "event", "trigger" ]
d4efb4d1af7f3948fa7bee43d54298c6164ac5bb
https://github.com/mizzencms/core/blob/d4efb4d1af7f3948fa7bee43d54298c6164ac5bb/src/EventManager.php#L61-L73
8,187
encorephp/container
src/Proxy.php
Proxy.shouldReceive
public static function shouldReceive() { $name = static::getConcreteBinding(); if (static::isMock()) { $mock = static::$instance[$name]; } else { $mock = static::createFreshMockInstance($name); } return call_user_func_array([$mock, 'shouldReceive'], func_get_args()); }
php
public static function shouldReceive() { $name = static::getConcreteBinding(); if (static::isMock()) { $mock = static::$instance[$name]; } else { $mock = static::createFreshMockInstance($name); } return call_user_func_array([$mock, 'shouldReceive'], func_get_args()); }
[ "public", "static", "function", "shouldReceive", "(", ")", "{", "$", "name", "=", "static", "::", "getConcreteBinding", "(", ")", ";", "if", "(", "static", "::", "isMock", "(", ")", ")", "{", "$", "mock", "=", "static", "::", "$", "instance", "[", "$", "name", "]", ";", "}", "else", "{", "$", "mock", "=", "static", "::", "createFreshMockInstance", "(", "$", "name", ")", ";", "}", "return", "call_user_func_array", "(", "[", "$", "mock", ",", "'shouldReceive'", "]", ",", "func_get_args", "(", ")", ")", ";", "}" ]
Initiate a mock expectation on the proxy. @param dynamic @return \Mockery\Expectation
[ "Initiate", "a", "mock", "expectation", "on", "the", "proxy", "." ]
49cb0b34fef912a9df962c5d4968a8e740eda4e8
https://github.com/encorephp/container/blob/49cb0b34fef912a9df962c5d4968a8e740eda4e8/src/Proxy.php#L44-L55
8,188
encorephp/container
src/Proxy.php
Proxy.resolveProxyInstance
protected static function resolveProxyInstance($name) { if (is_object($name)) return $name; if (isset(static::$instance[$name])) { return static::$instance[$name]; } return static::$instance[$name] = static::$container[$name]; }
php
protected static function resolveProxyInstance($name) { if (is_object($name)) return $name; if (isset(static::$instance[$name])) { return static::$instance[$name]; } return static::$instance[$name] = static::$container[$name]; }
[ "protected", "static", "function", "resolveProxyInstance", "(", "$", "name", ")", "{", "if", "(", "is_object", "(", "$", "name", ")", ")", "return", "$", "name", ";", "if", "(", "isset", "(", "static", "::", "$", "instance", "[", "$", "name", "]", ")", ")", "{", "return", "static", "::", "$", "instance", "[", "$", "name", "]", ";", "}", "return", "static", "::", "$", "instance", "[", "$", "name", "]", "=", "static", "::", "$", "container", "[", "$", "name", "]", ";", "}" ]
Resolve the proxy binding instance from the container. @param string $name @return mixed
[ "Resolve", "the", "proxy", "binding", "instance", "from", "the", "container", "." ]
49cb0b34fef912a9df962c5d4968a8e740eda4e8
https://github.com/encorephp/container/blob/49cb0b34fef912a9df962c5d4968a8e740eda4e8/src/Proxy.php#L137-L146
8,189
ncou/Chiron-PackageDiscovery
src/ComposerScripts.php
ComposerScripts.discoverPackages
private static function discoverPackages(string $vendorPath, string $manifestPath): void { $installedPackages = []; if (file_exists($path = $vendorPath . '/composer/installed.json')) { $installedPackages = json_decode(file_get_contents($path), true); } $discoverPackages = []; foreach ($installedPackages as $package) { if (! empty($package['extra']['chiron'])) { $packageInfo = $package['extra']['chiron']; $discoverPackages[$package['name']] = $packageInfo; } } if (! is_writable(dirname($manifestPath))) { throw new \RuntimeException('The directory "' . dirname($manifestPath) . '" must be present and writable.'); } file_put_contents($manifestPath, '<?php return ' . var_export($discoverPackages, true) . ';'); }
php
private static function discoverPackages(string $vendorPath, string $manifestPath): void { $installedPackages = []; if (file_exists($path = $vendorPath . '/composer/installed.json')) { $installedPackages = json_decode(file_get_contents($path), true); } $discoverPackages = []; foreach ($installedPackages as $package) { if (! empty($package['extra']['chiron'])) { $packageInfo = $package['extra']['chiron']; $discoverPackages[$package['name']] = $packageInfo; } } if (! is_writable(dirname($manifestPath))) { throw new \RuntimeException('The directory "' . dirname($manifestPath) . '" must be present and writable.'); } file_put_contents($manifestPath, '<?php return ' . var_export($discoverPackages, true) . ';'); }
[ "private", "static", "function", "discoverPackages", "(", "string", "$", "vendorPath", ",", "string", "$", "manifestPath", ")", ":", "void", "{", "$", "installedPackages", "=", "[", "]", ";", "if", "(", "file_exists", "(", "$", "path", "=", "$", "vendorPath", ".", "'/composer/installed.json'", ")", ")", "{", "$", "installedPackages", "=", "json_decode", "(", "file_get_contents", "(", "$", "path", ")", ",", "true", ")", ";", "}", "$", "discoverPackages", "=", "[", "]", ";", "foreach", "(", "$", "installedPackages", "as", "$", "package", ")", "{", "if", "(", "!", "empty", "(", "$", "package", "[", "'extra'", "]", "[", "'chiron'", "]", ")", ")", "{", "$", "packageInfo", "=", "$", "package", "[", "'extra'", "]", "[", "'chiron'", "]", ";", "$", "discoverPackages", "[", "$", "package", "[", "'name'", "]", "]", "=", "$", "packageInfo", ";", "}", "}", "if", "(", "!", "is_writable", "(", "dirname", "(", "$", "manifestPath", ")", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'The directory \"'", ".", "dirname", "(", "$", "manifestPath", ")", ".", "'\" must be present and writable.'", ")", ";", "}", "file_put_contents", "(", "$", "manifestPath", ",", "'<?php return '", ".", "var_export", "(", "$", "discoverPackages", ",", "true", ")", ".", "';'", ")", ";", "}" ]
Discover and Write the found packages in a manifest array file to disk. @param string $manifestPath @param array $manifest @throws \RuntimeException
[ "Discover", "and", "Write", "the", "found", "packages", "in", "a", "manifest", "array", "file", "to", "disk", "." ]
75516f964282928ae4910f5b848ad34afe3bc747
https://github.com/ncou/Chiron-PackageDiscovery/blob/75516f964282928ae4910f5b848ad34afe3bc747/src/ComposerScripts.php#L83-L103
8,190
ncou/Chiron-PackageDiscovery
src/ComposerScripts.php
ComposerScripts.copyFiles
public static function copyFiles(array $paths): void { foreach ($paths as $source => $target) { // handle file target as array [path, overwrite] $target = (array) $target; echo "Copying file $source to $target[0] - "; if (! is_file($source)) { echo "source file not found.\n"; continue; } if (is_file($target[0]) && empty($target[1])) { echo "target file exists - skip.\n"; continue; } elseif (is_file($target[0]) && ! empty($target[1])) { echo 'target file exists - overwrite - '; } try { if (! is_dir(dirname($target[0]))) { mkdir(dirname($target[0]), 0777, true); } if (copy($source, $target[0])) { echo "done.\n"; } } catch (\Exception $e) { echo $e->getMessage() . "\n"; } } }
php
public static function copyFiles(array $paths): void { foreach ($paths as $source => $target) { // handle file target as array [path, overwrite] $target = (array) $target; echo "Copying file $source to $target[0] - "; if (! is_file($source)) { echo "source file not found.\n"; continue; } if (is_file($target[0]) && empty($target[1])) { echo "target file exists - skip.\n"; continue; } elseif (is_file($target[0]) && ! empty($target[1])) { echo 'target file exists - overwrite - '; } try { if (! is_dir(dirname($target[0]))) { mkdir(dirname($target[0]), 0777, true); } if (copy($source, $target[0])) { echo "done.\n"; } } catch (\Exception $e) { echo $e->getMessage() . "\n"; } } }
[ "public", "static", "function", "copyFiles", "(", "array", "$", "paths", ")", ":", "void", "{", "foreach", "(", "$", "paths", "as", "$", "source", "=>", "$", "target", ")", "{", "// handle file target as array [path, overwrite]", "$", "target", "=", "(", "array", ")", "$", "target", ";", "echo", "\"Copying file $source to $target[0] - \"", ";", "if", "(", "!", "is_file", "(", "$", "source", ")", ")", "{", "echo", "\"source file not found.\\n\"", ";", "continue", ";", "}", "if", "(", "is_file", "(", "$", "target", "[", "0", "]", ")", "&&", "empty", "(", "$", "target", "[", "1", "]", ")", ")", "{", "echo", "\"target file exists - skip.\\n\"", ";", "continue", ";", "}", "elseif", "(", "is_file", "(", "$", "target", "[", "0", "]", ")", "&&", "!", "empty", "(", "$", "target", "[", "1", "]", ")", ")", "{", "echo", "'target file exists - overwrite - '", ";", "}", "try", "{", "if", "(", "!", "is_dir", "(", "dirname", "(", "$", "target", "[", "0", "]", ")", ")", ")", "{", "mkdir", "(", "dirname", "(", "$", "target", "[", "0", "]", ")", ",", "0777", ",", "true", ")", ";", "}", "if", "(", "copy", "(", "$", "source", ",", "$", "target", "[", "0", "]", ")", ")", "{", "echo", "\"done.\\n\"", ";", "}", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "echo", "$", "e", "->", "getMessage", "(", ")", ".", "\"\\n\"", ";", "}", "}", "}" ]
Copy files to specified locations. @param array $paths The source files paths (keys) and the corresponding target locations for copied files (values). Location can be specified as an array - first element is target location, second defines whether file can be overwritten (by default method don't overwrite existing files).
[ "Copy", "files", "to", "specified", "locations", "." ]
75516f964282928ae4910f5b848ad34afe3bc747
https://github.com/ncou/Chiron-PackageDiscovery/blob/75516f964282928ae4910f5b848ad34afe3bc747/src/ComposerScripts.php#L201-L231
8,191
skeeks-cms/cms-agent
src/models/CmsAgentModel.php
CmsAgentModel.stopLongExecutable
static public function stopLongExecutable($agentMaxExecuteTime = null) { if ($agentMaxExecuteTime === null) { $agentMaxExecuteTime = \Yii::$app->cmsAgent->agentMaxExecuteTime; } $time = \Yii::$app->formatter->asTimestamp(time()) - (int)$agentMaxExecuteTime; $running = static::find() ->where([ 'is_running' => Cms::BOOL_Y ]) ->orderBy('priority') ->all();; $stoping = 0; if ($running) { /** * @var $agent CmsAgent */ foreach ($running as $agent) { if ($agent->next_exec_at <= $time) { if ($agent->stop()) { $stoping++; } else { \Yii::error('Not stopped long agent: ' . $agent->name, 'skeeks/agent'); } } } } return $stoping; }
php
static public function stopLongExecutable($agentMaxExecuteTime = null) { if ($agentMaxExecuteTime === null) { $agentMaxExecuteTime = \Yii::$app->cmsAgent->agentMaxExecuteTime; } $time = \Yii::$app->formatter->asTimestamp(time()) - (int)$agentMaxExecuteTime; $running = static::find() ->where([ 'is_running' => Cms::BOOL_Y ]) ->orderBy('priority') ->all();; $stoping = 0; if ($running) { /** * @var $agent CmsAgent */ foreach ($running as $agent) { if ($agent->next_exec_at <= $time) { if ($agent->stop()) { $stoping++; } else { \Yii::error('Not stopped long agent: ' . $agent->name, 'skeeks/agent'); } } } } return $stoping; }
[ "static", "public", "function", "stopLongExecutable", "(", "$", "agentMaxExecuteTime", "=", "null", ")", "{", "if", "(", "$", "agentMaxExecuteTime", "===", "null", ")", "{", "$", "agentMaxExecuteTime", "=", "\\", "Yii", "::", "$", "app", "->", "cmsAgent", "->", "agentMaxExecuteTime", ";", "}", "$", "time", "=", "\\", "Yii", "::", "$", "app", "->", "formatter", "->", "asTimestamp", "(", "time", "(", ")", ")", "-", "(", "int", ")", "$", "agentMaxExecuteTime", ";", "$", "running", "=", "static", "::", "find", "(", ")", "->", "where", "(", "[", "'is_running'", "=>", "Cms", "::", "BOOL_Y", "]", ")", "->", "orderBy", "(", "'priority'", ")", "->", "all", "(", ")", ";", ";", "$", "stoping", "=", "0", ";", "if", "(", "$", "running", ")", "{", "/**\n * @var $agent CmsAgent\n */", "foreach", "(", "$", "running", "as", "$", "agent", ")", "{", "if", "(", "$", "agent", "->", "next_exec_at", "<=", "$", "time", ")", "{", "if", "(", "$", "agent", "->", "stop", "(", ")", ")", "{", "$", "stoping", "++", ";", "}", "else", "{", "\\", "Yii", "::", "error", "(", "'Not stopped long agent: '", ".", "$", "agent", "->", "name", ",", "'skeeks/agent'", ")", ";", "}", "}", "}", "}", "return", "$", "stoping", ";", "}" ]
Stop long executable agents @return int
[ "Stop", "long", "executable", "agents" ]
d2fc8ea14d66b2e8c3b484f97cfa64e270c993fc
https://github.com/skeeks-cms/cms-agent/blob/d2fc8ea14d66b2e8c3b484f97cfa64e270c993fc/src/models/CmsAgentModel.php#L125-L158
8,192
atelierspierrot/validators
src/Validator/StringMaskValidator.php
StringMaskValidator.setMask
public function setMask($mask, $protect = null) { if (!is_null($protect)) { $this->setPregQuote($protect); } $this->mask = $mask; return $this; }
php
public function setMask($mask, $protect = null) { if (!is_null($protect)) { $this->setPregQuote($protect); } $this->mask = $mask; return $this; }
[ "public", "function", "setMask", "(", "$", "mask", ",", "$", "protect", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "protect", ")", ")", "{", "$", "this", "->", "setPregQuote", "(", "$", "protect", ")", ";", "}", "$", "this", "->", "mask", "=", "$", "mask", ";", "return", "$", "this", ";", "}" ]
Set the mask to test for values The mask can be escaped by the 'preg_quote' function setting the second argument on TRUE. @param string $mask The mask to test in PCRE @param bool $protect Do we have to protect the mask ? @return object $this for method chaining
[ "Set", "the", "mask", "to", "test", "for", "values", "The", "mask", "can", "be", "escaped", "by", "the", "preg_quote", "function", "setting", "the", "second", "argument", "on", "TRUE", "." ]
6c97b10bfe8324b33771f24cee8c722d7bc3bb15
https://github.com/atelierspierrot/validators/blob/6c97b10bfe8324b33771f24cee8c722d7bc3bb15/src/Validator/StringMaskValidator.php#L100-L107
8,193
atelierspierrot/validators
src/Validator/StringMaskValidator.php
StringMaskValidator.buildErrorString
protected function buildErrorString() { $args = func_get_args(); $error_str = array_shift($args); $ref_suffix = array_shift($args); if (!empty($this->mask_reference)) { array_push($args, $this->mask_reference); $error_str .= $ref_suffix; } array_unshift($args, $error_str); return call_user_func_array('sprintf', $args); }
php
protected function buildErrorString() { $args = func_get_args(); $error_str = array_shift($args); $ref_suffix = array_shift($args); if (!empty($this->mask_reference)) { array_push($args, $this->mask_reference); $error_str .= $ref_suffix; } array_unshift($args, $error_str); return call_user_func_array('sprintf', $args); }
[ "protected", "function", "buildErrorString", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "error_str", "=", "array_shift", "(", "$", "args", ")", ";", "$", "ref_suffix", "=", "array_shift", "(", "$", "args", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "mask_reference", ")", ")", "{", "array_push", "(", "$", "args", ",", "$", "this", "->", "mask_reference", ")", ";", "$", "error_str", ".=", "$", "ref_suffix", ";", "}", "array_unshift", "(", "$", "args", ",", "$", "error_str", ")", ";", "return", "call_user_func_array", "(", "'sprintf'", ",", "$", "args", ")", ";", "}" ]
Build an error string adding the mask reference if known @param string $first The first parameter must be the global error string @param string $second The second parameter must be an alternative part of the error string, added if the mask reference is known @param mixed $others The rest of the parameters are taken and passed to the finale 'sprintf' function @return mixed
[ "Build", "an", "error", "string", "adding", "the", "mask", "reference", "if", "known" ]
6c97b10bfe8324b33771f24cee8c722d7bc3bb15
https://github.com/atelierspierrot/validators/blob/6c97b10bfe8324b33771f24cee8c722d7bc3bb15/src/Validator/StringMaskValidator.php#L209-L222
8,194
lucifurious/kisma
src/Kisma/Core/Services/SeedCli.php
SeedCli.getArguments
public function getArguments( $arguments = array() ) { $_results = array( 'original' => $arguments, 'rebuilt' => array(), 'options' => array(), ); // Our return options array... $_options = array(); // Rebuild args... for ( $_i = 0, $_count = count( $arguments ); $_i < $_count; $_i++ ) { $_argument = $arguments[$_i]; $_value = trim( substr( $_argument, 0, strpos( $_argument, '=' ) ) ); if ( $_value && $_value[0] == '-' && $_value[1] == '-' ) { $_options[substr( $_value, 2 )] = str_replace( $_value . '=', '', $_argument ); } elseif ( $_value && $_value[0] == '-' ) { $_options[substr( $_value, 1 )] = str_replace( $_value . '=', '', $_argument ); } else { $_results['rebuilt'][] = $arguments[$_i]; } } $_results['options'] = $_options; // Return the processed results... return $_results; }
php
public function getArguments( $arguments = array() ) { $_results = array( 'original' => $arguments, 'rebuilt' => array(), 'options' => array(), ); // Our return options array... $_options = array(); // Rebuild args... for ( $_i = 0, $_count = count( $arguments ); $_i < $_count; $_i++ ) { $_argument = $arguments[$_i]; $_value = trim( substr( $_argument, 0, strpos( $_argument, '=' ) ) ); if ( $_value && $_value[0] == '-' && $_value[1] == '-' ) { $_options[substr( $_value, 2 )] = str_replace( $_value . '=', '', $_argument ); } elseif ( $_value && $_value[0] == '-' ) { $_options[substr( $_value, 1 )] = str_replace( $_value . '=', '', $_argument ); } else { $_results['rebuilt'][] = $arguments[$_i]; } } $_results['options'] = $_options; // Return the processed results... return $_results; }
[ "public", "function", "getArguments", "(", "$", "arguments", "=", "array", "(", ")", ")", "{", "$", "_results", "=", "array", "(", "'original'", "=>", "$", "arguments", ",", "'rebuilt'", "=>", "array", "(", ")", ",", "'options'", "=>", "array", "(", ")", ",", ")", ";", "//\tOur return options array...", "$", "_options", "=", "array", "(", ")", ";", "//\tRebuild args...", "for", "(", "$", "_i", "=", "0", ",", "$", "_count", "=", "count", "(", "$", "arguments", ")", ";", "$", "_i", "<", "$", "_count", ";", "$", "_i", "++", ")", "{", "$", "_argument", "=", "$", "arguments", "[", "$", "_i", "]", ";", "$", "_value", "=", "trim", "(", "substr", "(", "$", "_argument", ",", "0", ",", "strpos", "(", "$", "_argument", ",", "'='", ")", ")", ")", ";", "if", "(", "$", "_value", "&&", "$", "_value", "[", "0", "]", "==", "'-'", "&&", "$", "_value", "[", "1", "]", "==", "'-'", ")", "{", "$", "_options", "[", "substr", "(", "$", "_value", ",", "2", ")", "]", "=", "str_replace", "(", "$", "_value", ".", "'='", ",", "''", ",", "$", "_argument", ")", ";", "}", "elseif", "(", "$", "_value", "&&", "$", "_value", "[", "0", "]", "==", "'-'", ")", "{", "$", "_options", "[", "substr", "(", "$", "_value", ",", "1", ")", "]", "=", "str_replace", "(", "$", "_value", ".", "'='", ",", "''", ",", "$", "_argument", ")", ";", "}", "else", "{", "$", "_results", "[", "'rebuilt'", "]", "[", "]", "=", "$", "arguments", "[", "$", "_i", "]", ";", "}", "}", "$", "_results", "[", "'options'", "]", "=", "$", "_options", ";", "//\tReturn the processed results...", "return", "$", "_results", ";", "}" ]
Processes the command line arguments @param array $arguments @return array
[ "Processes", "the", "command", "line", "arguments" ]
4cc9954249da4e535b52f154e728935f07e648ae
https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma/Core/Services/SeedCli.php#L77-L112
8,195
lucifurious/kisma
src/Kisma/Core/Services/SeedCli.php
SeedCli._processArguments
protected function _processArguments( $arguments ) { // Process command line arguments $_className = array_shift( $arguments ); $_options = $this->getArguments( $arguments ); $arguments = array_merge( array($_className), $_options['rebuilt'] ); // Set our values based on options... $this->set( $_options ); return $arguments; }
php
protected function _processArguments( $arguments ) { // Process command line arguments $_className = array_shift( $arguments ); $_options = $this->getArguments( $arguments ); $arguments = array_merge( array($_className), $_options['rebuilt'] ); // Set our values based on options... $this->set( $_options ); return $arguments; }
[ "protected", "function", "_processArguments", "(", "$", "arguments", ")", "{", "//\tProcess command line arguments", "$", "_className", "=", "array_shift", "(", "$", "arguments", ")", ";", "$", "_options", "=", "$", "this", "->", "getArguments", "(", "$", "arguments", ")", ";", "$", "arguments", "=", "array_merge", "(", "array", "(", "$", "_className", ")", ",", "$", "_options", "[", "'rebuilt'", "]", ")", ";", "//\tSet our values based on options...", "$", "this", "->", "set", "(", "$", "_options", ")", ";", "return", "$", "arguments", ";", "}" ]
Process arguments passed in @param array $arguments @return array
[ "Process", "arguments", "passed", "in" ]
4cc9954249da4e535b52f154e728935f07e648ae
https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma/Core/Services/SeedCli.php#L121-L132
8,196
messagex/messagex-php-sdk-common
src/Hmac.php
Hmac.sign
public static function sign(RequestInterface $request, Credentials $credentials) { /** * @var RequestInterface $request */ $signatureHeaders = []; $base64Md5 = ''; $contentLength = ''; if ($request->getBody()->getSize() !== 0) { $base64Md5 = Hmac::md5HashBase64( $request->getBody() ->getContents() ); $contentLength = strlen((string)$request->getBody()); $signatureHeaders = array_merge( $signatureHeaders, [ 'content-type' => $request->getHeader('content-type'), 'content-md5' => $base64Md5, 'content-length' => $contentLength ]); } $parsedUrl = parse_url($request->getUri()); $targetUrl = $parsedUrl["path"]; if (!empty($parsedUrl["query"])) { $targetUrl = $targetUrl . "?" . $parsedUrl["query"]; } $requestLine = $request->getMethod() . " " . $targetUrl . " HTTP/1.1"; $signatureHeaders['date'] = $date = gmdate("D, d M Y H:i:s", time()) . " GMT"; $signatureHeaders['request-line'] = $requestLine; $headersString = Hmac::getHeadersString($signatureHeaders); $signatureString = Hmac::getSignatureString($signatureHeaders); $signatureHash = Hmac::shaHashBase64($signatureString, $credentials->getSecret()); $authHeader = sprintf( 'hmac username="%s", algorithm="hmac-%s", headers="%s", signature="%s"', $credentials->getAccessKey(), Hmac::ALGORITHM_SHA256, $headersString, $signatureHash ); $request = $request->withHeader('Authorization', $authHeader) ->withHeader('Date', $date); if ($request->getBody()->getSize()) { return $request->withHeader('Content-Type', $request->getHeader('content-type')) ->withHeader('Content-MD5', $base64Md5) ->withHeader('Content-Length', $contentLength); } return $request; }
php
public static function sign(RequestInterface $request, Credentials $credentials) { /** * @var RequestInterface $request */ $signatureHeaders = []; $base64Md5 = ''; $contentLength = ''; if ($request->getBody()->getSize() !== 0) { $base64Md5 = Hmac::md5HashBase64( $request->getBody() ->getContents() ); $contentLength = strlen((string)$request->getBody()); $signatureHeaders = array_merge( $signatureHeaders, [ 'content-type' => $request->getHeader('content-type'), 'content-md5' => $base64Md5, 'content-length' => $contentLength ]); } $parsedUrl = parse_url($request->getUri()); $targetUrl = $parsedUrl["path"]; if (!empty($parsedUrl["query"])) { $targetUrl = $targetUrl . "?" . $parsedUrl["query"]; } $requestLine = $request->getMethod() . " " . $targetUrl . " HTTP/1.1"; $signatureHeaders['date'] = $date = gmdate("D, d M Y H:i:s", time()) . " GMT"; $signatureHeaders['request-line'] = $requestLine; $headersString = Hmac::getHeadersString($signatureHeaders); $signatureString = Hmac::getSignatureString($signatureHeaders); $signatureHash = Hmac::shaHashBase64($signatureString, $credentials->getSecret()); $authHeader = sprintf( 'hmac username="%s", algorithm="hmac-%s", headers="%s", signature="%s"', $credentials->getAccessKey(), Hmac::ALGORITHM_SHA256, $headersString, $signatureHash ); $request = $request->withHeader('Authorization', $authHeader) ->withHeader('Date', $date); if ($request->getBody()->getSize()) { return $request->withHeader('Content-Type', $request->getHeader('content-type')) ->withHeader('Content-MD5', $base64Md5) ->withHeader('Content-Length', $contentLength); } return $request; }
[ "public", "static", "function", "sign", "(", "RequestInterface", "$", "request", ",", "Credentials", "$", "credentials", ")", "{", "/**\n * @var RequestInterface $request\n */", "$", "signatureHeaders", "=", "[", "]", ";", "$", "base64Md5", "=", "''", ";", "$", "contentLength", "=", "''", ";", "if", "(", "$", "request", "->", "getBody", "(", ")", "->", "getSize", "(", ")", "!==", "0", ")", "{", "$", "base64Md5", "=", "Hmac", "::", "md5HashBase64", "(", "$", "request", "->", "getBody", "(", ")", "->", "getContents", "(", ")", ")", ";", "$", "contentLength", "=", "strlen", "(", "(", "string", ")", "$", "request", "->", "getBody", "(", ")", ")", ";", "$", "signatureHeaders", "=", "array_merge", "(", "$", "signatureHeaders", ",", "[", "'content-type'", "=>", "$", "request", "->", "getHeader", "(", "'content-type'", ")", ",", "'content-md5'", "=>", "$", "base64Md5", ",", "'content-length'", "=>", "$", "contentLength", "]", ")", ";", "}", "$", "parsedUrl", "=", "parse_url", "(", "$", "request", "->", "getUri", "(", ")", ")", ";", "$", "targetUrl", "=", "$", "parsedUrl", "[", "\"path\"", "]", ";", "if", "(", "!", "empty", "(", "$", "parsedUrl", "[", "\"query\"", "]", ")", ")", "{", "$", "targetUrl", "=", "$", "targetUrl", ".", "\"?\"", ".", "$", "parsedUrl", "[", "\"query\"", "]", ";", "}", "$", "requestLine", "=", "$", "request", "->", "getMethod", "(", ")", ".", "\" \"", ".", "$", "targetUrl", ".", "\" HTTP/1.1\"", ";", "$", "signatureHeaders", "[", "'date'", "]", "=", "$", "date", "=", "gmdate", "(", "\"D, d M Y H:i:s\"", ",", "time", "(", ")", ")", ".", "\" GMT\"", ";", "$", "signatureHeaders", "[", "'request-line'", "]", "=", "$", "requestLine", ";", "$", "headersString", "=", "Hmac", "::", "getHeadersString", "(", "$", "signatureHeaders", ")", ";", "$", "signatureString", "=", "Hmac", "::", "getSignatureString", "(", "$", "signatureHeaders", ")", ";", "$", "signatureHash", "=", "Hmac", "::", "shaHashBase64", "(", "$", "signatureString", ",", "$", "credentials", "->", "getSecret", "(", ")", ")", ";", "$", "authHeader", "=", "sprintf", "(", "'hmac username=\"%s\", algorithm=\"hmac-%s\", headers=\"%s\", signature=\"%s\"'", ",", "$", "credentials", "->", "getAccessKey", "(", ")", ",", "Hmac", "::", "ALGORITHM_SHA256", ",", "$", "headersString", ",", "$", "signatureHash", ")", ";", "$", "request", "=", "$", "request", "->", "withHeader", "(", "'Authorization'", ",", "$", "authHeader", ")", "->", "withHeader", "(", "'Date'", ",", "$", "date", ")", ";", "if", "(", "$", "request", "->", "getBody", "(", ")", "->", "getSize", "(", ")", ")", "{", "return", "$", "request", "->", "withHeader", "(", "'Content-Type'", ",", "$", "request", "->", "getHeader", "(", "'content-type'", ")", ")", "->", "withHeader", "(", "'Content-MD5'", ",", "$", "base64Md5", ")", "->", "withHeader", "(", "'Content-Length'", ",", "$", "contentLength", ")", ";", "}", "return", "$", "request", ";", "}" ]
Signs the request with the credentials. @param RequestInterface $request @param Credentials $credentials @return RequestInterface
[ "Signs", "the", "request", "with", "the", "credentials", "." ]
c311e9305afbc49fd7f04a57fc5bdfad6c282c21
https://github.com/messagex/messagex-php-sdk-common/blob/c311e9305afbc49fd7f04a57fc5bdfad6c282c21/src/Hmac.php#L46-L104
8,197
messagex/messagex-php-sdk-common
src/Hmac.php
Hmac.shaHashBase64
public static function shaHashBase64($signature, $secret) { return base64_encode( hash_hmac(Hmac::ALGORITHM_SHA256, $signature, $secret, true) ); }
php
public static function shaHashBase64($signature, $secret) { return base64_encode( hash_hmac(Hmac::ALGORITHM_SHA256, $signature, $secret, true) ); }
[ "public", "static", "function", "shaHashBase64", "(", "$", "signature", ",", "$", "secret", ")", "{", "return", "base64_encode", "(", "hash_hmac", "(", "Hmac", "::", "ALGORITHM_SHA256", ",", "$", "signature", ",", "$", "secret", ",", "true", ")", ")", ";", "}" ]
Base64 of signature hashed with HMAC using SHA hash. @param string $signature String composed of specific headers. @param string $secret Secret part of credentials. @return string Base64 string.
[ "Base64", "of", "signature", "hashed", "with", "HMAC", "using", "SHA", "hash", "." ]
c311e9305afbc49fd7f04a57fc5bdfad6c282c21
https://github.com/messagex/messagex-php-sdk-common/blob/c311e9305afbc49fd7f04a57fc5bdfad6c282c21/src/Hmac.php#L124-L129
8,198
messagex/messagex-php-sdk-common
src/Hmac.php
Hmac.getSignatureString
public static function getSignatureString(array $signatureHeaders) { $signature = ''; foreach ($signatureHeaders as $header => $value) { if ($signature !== '') { $signature .= "\n"; } if (is_array($value)) { $value = $value[0]; } $signature = mb_strtolower($header) === "request-line" ? "{$signature}{$value}" : $signature . mb_strtolower($header) . ": {$value}"; } return $signature; }
php
public static function getSignatureString(array $signatureHeaders) { $signature = ''; foreach ($signatureHeaders as $header => $value) { if ($signature !== '') { $signature .= "\n"; } if (is_array($value)) { $value = $value[0]; } $signature = mb_strtolower($header) === "request-line" ? "{$signature}{$value}" : $signature . mb_strtolower($header) . ": {$value}"; } return $signature; }
[ "public", "static", "function", "getSignatureString", "(", "array", "$", "signatureHeaders", ")", "{", "$", "signature", "=", "''", ";", "foreach", "(", "$", "signatureHeaders", "as", "$", "header", "=>", "$", "value", ")", "{", "if", "(", "$", "signature", "!==", "''", ")", "{", "$", "signature", ".=", "\"\\n\"", ";", "}", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "$", "value", "[", "0", "]", ";", "}", "$", "signature", "=", "mb_strtolower", "(", "$", "header", ")", "===", "\"request-line\"", "?", "\"{$signature}{$value}\"", ":", "$", "signature", ".", "mb_strtolower", "(", "$", "header", ")", ".", "\": {$value}\"", ";", "}", "return", "$", "signature", ";", "}" ]
Builds signature string used for signing of the request. @param array $signatureHeaders Specific headers for signing request. @return string String composed of signature headers.
[ "Builds", "signature", "string", "used", "for", "signing", "of", "the", "request", "." ]
c311e9305afbc49fd7f04a57fc5bdfad6c282c21
https://github.com/messagex/messagex-php-sdk-common/blob/c311e9305afbc49fd7f04a57fc5bdfad6c282c21/src/Hmac.php#L137-L156
8,199
sebastianmonzel/webfiles-framework-php
source/core/datasystem/file/system/MDirectory.php
MDirectory.getSubdirectories
public function getSubdirectories() { $directories = array(); if ($directoryHandle = opendir($this->m_sPath)) { while (false !== ($sFileName = readdir($directoryHandle))) { if ( $sFileName != "." && $sFileName != ".." && (is_dir($this->m_sPath . "/" . $sFileName))) { array_push($directories, $sFileName); } } } sort($directories); return $directories; }
php
public function getSubdirectories() { $directories = array(); if ($directoryHandle = opendir($this->m_sPath)) { while (false !== ($sFileName = readdir($directoryHandle))) { if ( $sFileName != "." && $sFileName != ".." && (is_dir($this->m_sPath . "/" . $sFileName))) { array_push($directories, $sFileName); } } } sort($directories); return $directories; }
[ "public", "function", "getSubdirectories", "(", ")", "{", "$", "directories", "=", "array", "(", ")", ";", "if", "(", "$", "directoryHandle", "=", "opendir", "(", "$", "this", "->", "m_sPath", ")", ")", "{", "while", "(", "false", "!==", "(", "$", "sFileName", "=", "readdir", "(", "$", "directoryHandle", ")", ")", ")", "{", "if", "(", "$", "sFileName", "!=", "\".\"", "&&", "$", "sFileName", "!=", "\"..\"", "&&", "(", "is_dir", "(", "$", "this", "->", "m_sPath", ".", "\"/\"", ".", "$", "sFileName", ")", ")", ")", "{", "array_push", "(", "$", "directories", ",", "$", "sFileName", ")", ";", "}", "}", "}", "sort", "(", "$", "directories", ")", ";", "return", "$", "directories", ";", "}" ]
Returns the subdirectories of the current directory. @return array list of directories
[ "Returns", "the", "subdirectories", "of", "the", "current", "directory", "." ]
5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d
https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datasystem/file/system/MDirectory.php#L94-L110