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
10,000
leedave/resource-mysql
src/Mysql.php
Mysql.loadByPrepStmt
public function loadByPrepStmt( array $arrWhat = ['*'], array $arrWhere = [], array $arrOrder = ['`id` ASC'], array $arrLimit = [] ) : array { $arrStmt = []; $strWhere = ""; if (count($arrWhere) > 0) { $arrWhereNames = []; foreach ($arrWhere as $key => $val) { if (is_array($val) && $val['operator'] === "like") { $arrWhereNames[] = "`".$key."` LIKE :".$key; $arrStmt[':'.$key] = $val['value']; } else { $arrWhereNames[] = "`".$key."` = :".$key; $arrStmt[':'.$key] = $val; } } $strWhere = "WHERE ". implode(" AND ", $arrWhereNames) . " "; } $strOrder = ""; if (count($arrOrder) > 0) { $strOrder = "ORDER BY ".implode(", ", $arrOrder) . " "; } $strLimit = ""; if (isset($arrLimit[0])) { $strLimit .= "LIMIT ".((int) $arrLimit[0]); } if (isset($arrLimit[1])) { $strLimit .= "," . ((int) $arrLimit[1]); } $sql = "SELECT ".implode(",", $arrWhat)." FROM `".$this->tableName."` " . $strWhere . $strOrder . $strLimit; $stmt = $this->db->prepare($sql); $stmt->execute($arrStmt); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if (!$result) { return []; } return $result; }
php
public function loadByPrepStmt( array $arrWhat = ['*'], array $arrWhere = [], array $arrOrder = ['`id` ASC'], array $arrLimit = [] ) : array { $arrStmt = []; $strWhere = ""; if (count($arrWhere) > 0) { $arrWhereNames = []; foreach ($arrWhere as $key => $val) { if (is_array($val) && $val['operator'] === "like") { $arrWhereNames[] = "`".$key."` LIKE :".$key; $arrStmt[':'.$key] = $val['value']; } else { $arrWhereNames[] = "`".$key."` = :".$key; $arrStmt[':'.$key] = $val; } } $strWhere = "WHERE ". implode(" AND ", $arrWhereNames) . " "; } $strOrder = ""; if (count($arrOrder) > 0) { $strOrder = "ORDER BY ".implode(", ", $arrOrder) . " "; } $strLimit = ""; if (isset($arrLimit[0])) { $strLimit .= "LIMIT ".((int) $arrLimit[0]); } if (isset($arrLimit[1])) { $strLimit .= "," . ((int) $arrLimit[1]); } $sql = "SELECT ".implode(",", $arrWhat)." FROM `".$this->tableName."` " . $strWhere . $strOrder . $strLimit; $stmt = $this->db->prepare($sql); $stmt->execute($arrStmt); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if (!$result) { return []; } return $result; }
[ "public", "function", "loadByPrepStmt", "(", "array", "$", "arrWhat", "=", "[", "'*'", "]", ",", "array", "$", "arrWhere", "=", "[", "]", ",", "array", "$", "arrOrder", "=", "[", "'`id` ASC'", "]", ",", "array", "$", "arrLimit", "=", "[", "]", ")", ":", "array", "{", "$", "arrStmt", "=", "[", "]", ";", "$", "strWhere", "=", "\"\"", ";", "if", "(", "count", "(", "$", "arrWhere", ")", ">", "0", ")", "{", "$", "arrWhereNames", "=", "[", "]", ";", "foreach", "(", "$", "arrWhere", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "is_array", "(", "$", "val", ")", "&&", "$", "val", "[", "'operator'", "]", "===", "\"like\"", ")", "{", "$", "arrWhereNames", "[", "]", "=", "\"`\"", ".", "$", "key", ".", "\"` LIKE :\"", ".", "$", "key", ";", "$", "arrStmt", "[", "':'", ".", "$", "key", "]", "=", "$", "val", "[", "'value'", "]", ";", "}", "else", "{", "$", "arrWhereNames", "[", "]", "=", "\"`\"", ".", "$", "key", ".", "\"` = :\"", ".", "$", "key", ";", "$", "arrStmt", "[", "':'", ".", "$", "key", "]", "=", "$", "val", ";", "}", "}", "$", "strWhere", "=", "\"WHERE \"", ".", "implode", "(", "\" AND \"", ",", "$", "arrWhereNames", ")", ".", "\" \"", ";", "}", "$", "strOrder", "=", "\"\"", ";", "if", "(", "count", "(", "$", "arrOrder", ")", ">", "0", ")", "{", "$", "strOrder", "=", "\"ORDER BY \"", ".", "implode", "(", "\", \"", ",", "$", "arrOrder", ")", ".", "\" \"", ";", "}", "$", "strLimit", "=", "\"\"", ";", "if", "(", "isset", "(", "$", "arrLimit", "[", "0", "]", ")", ")", "{", "$", "strLimit", ".=", "\"LIMIT \"", ".", "(", "(", "int", ")", "$", "arrLimit", "[", "0", "]", ")", ";", "}", "if", "(", "isset", "(", "$", "arrLimit", "[", "1", "]", ")", ")", "{", "$", "strLimit", ".=", "\",\"", ".", "(", "(", "int", ")", "$", "arrLimit", "[", "1", "]", ")", ";", "}", "$", "sql", "=", "\"SELECT \"", ".", "implode", "(", "\",\"", ",", "$", "arrWhat", ")", ".", "\" FROM `\"", ".", "$", "this", "->", "tableName", ".", "\"` \"", ".", "$", "strWhere", ".", "$", "strOrder", ".", "$", "strLimit", ";", "$", "stmt", "=", "$", "this", "->", "db", "->", "prepare", "(", "$", "sql", ")", ";", "$", "stmt", "->", "execute", "(", "$", "arrStmt", ")", ";", "$", "result", "=", "$", "stmt", "->", "fetchAll", "(", "PDO", "::", "FETCH_ASSOC", ")", ";", "if", "(", "!", "$", "result", ")", "{", "return", "[", "]", ";", "}", "return", "$", "result", ";", "}" ]
Get Rows from Table using a Prepared Statement @param array $arrWhat @param array $arrWhere associative ["name" => "Dave"] OR ["name" => ["operator" => "like", "value" => "Dave"]] @param array $arrOrder @param array $arrLimit @return array
[ "Get", "Rows", "from", "Table", "using", "a", "Prepared", "Statement" ]
68305dac50b1b956f08f41267d0b2912850d8232
https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L395-L444
10,001
leedave/resource-mysql
src/Mysql.php
Mysql.getJsonRows
public function getJsonRows( array $arrWhat = ['*'], array $arrWhere = [], array $arrOrder = ['`id` ASC'], array $arrLimit = [] ) : string { $rows = $this->loadByPrepStmt($arrWhat, $arrWhere, $arrOrder, $arrLimit); $json = json_encode($rows, JSON_UNESCAPED_UNICODE); return $json; }
php
public function getJsonRows( array $arrWhat = ['*'], array $arrWhere = [], array $arrOrder = ['`id` ASC'], array $arrLimit = [] ) : string { $rows = $this->loadByPrepStmt($arrWhat, $arrWhere, $arrOrder, $arrLimit); $json = json_encode($rows, JSON_UNESCAPED_UNICODE); return $json; }
[ "public", "function", "getJsonRows", "(", "array", "$", "arrWhat", "=", "[", "'*'", "]", ",", "array", "$", "arrWhere", "=", "[", "]", ",", "array", "$", "arrOrder", "=", "[", "'`id` ASC'", "]", ",", "array", "$", "arrLimit", "=", "[", "]", ")", ":", "string", "{", "$", "rows", "=", "$", "this", "->", "loadByPrepStmt", "(", "$", "arrWhat", ",", "$", "arrWhere", ",", "$", "arrOrder", ",", "$", "arrLimit", ")", ";", "$", "json", "=", "json_encode", "(", "$", "rows", ",", "JSON_UNESCAPED_UNICODE", ")", ";", "return", "$", "json", ";", "}" ]
Extension to LoadByPrepStmt, this will return result as JSON instead of array @param array $arrWhat @param array $arrWhere @param array $arrOrder @param array $arrLimit @return string JSON
[ "Extension", "to", "LoadByPrepStmt", "this", "will", "return", "result", "as", "JSON", "instead", "of", "array" ]
68305dac50b1b956f08f41267d0b2912850d8232
https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L454-L464
10,002
leedave/resource-mysql
src/Mysql.php
Mysql.load
public function load(int $id) { $sql = "SELECT * FROM `".$this->tableName."` " . "WHERE `".$this->primaryKey."` = '".$id."'" . "LIMIT 0,1;"; $stmt = $this->db->query($sql); try { $row = $stmt->fetch(PDO::FETCH_ASSOC); } catch (Exception $ex) { $this->log->crit('Could not find requested entry in mySQL: '.$sql."\n".$ex->getMessage()); } if (!is_array($row)) { return; } $this->loadWithData($row); }
php
public function load(int $id) { $sql = "SELECT * FROM `".$this->tableName."` " . "WHERE `".$this->primaryKey."` = '".$id."'" . "LIMIT 0,1;"; $stmt = $this->db->query($sql); try { $row = $stmt->fetch(PDO::FETCH_ASSOC); } catch (Exception $ex) { $this->log->crit('Could not find requested entry in mySQL: '.$sql."\n".$ex->getMessage()); } if (!is_array($row)) { return; } $this->loadWithData($row); }
[ "public", "function", "load", "(", "int", "$", "id", ")", "{", "$", "sql", "=", "\"SELECT * FROM `\"", ".", "$", "this", "->", "tableName", ".", "\"` \"", ".", "\"WHERE `\"", ".", "$", "this", "->", "primaryKey", ".", "\"` = '\"", ".", "$", "id", ".", "\"'\"", ".", "\"LIMIT 0,1;\"", ";", "$", "stmt", "=", "$", "this", "->", "db", "->", "query", "(", "$", "sql", ")", ";", "try", "{", "$", "row", "=", "$", "stmt", "->", "fetch", "(", "PDO", "::", "FETCH_ASSOC", ")", ";", "}", "catch", "(", "Exception", "$", "ex", ")", "{", "$", "this", "->", "log", "->", "crit", "(", "'Could not find requested entry in mySQL: '", ".", "$", "sql", ".", "\"\\n\"", ".", "$", "ex", "->", "getMessage", "(", ")", ")", ";", "}", "if", "(", "!", "is_array", "(", "$", "row", ")", ")", "{", "return", ";", "}", "$", "this", "->", "loadWithData", "(", "$", "row", ")", ";", "}" ]
Load specific entry from DB @param int $id primary key @return void
[ "Load", "specific", "entry", "from", "DB" ]
68305dac50b1b956f08f41267d0b2912850d8232
https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L471-L489
10,003
dave-redfern/somnambulist-doctrine-enum-bridge
src/EnumerationBridge.php
EnumerationBridge.registerEnumTypes
public static function registerEnumTypes(array $types = []) { foreach ($types as $name => $callbacks) { [$constructor, $serializer] = (is_array($callbacks) ? $callbacks : [$callbacks, null]); static::registerEnumType($name, $constructor, $serializer); } }
php
public static function registerEnumTypes(array $types = []) { foreach ($types as $name => $callbacks) { [$constructor, $serializer] = (is_array($callbacks) ? $callbacks : [$callbacks, null]); static::registerEnumType($name, $constructor, $serializer); } }
[ "public", "static", "function", "registerEnumTypes", "(", "array", "$", "types", "=", "[", "]", ")", "{", "foreach", "(", "$", "types", "as", "$", "name", "=>", "$", "callbacks", ")", "{", "[", "$", "constructor", ",", "$", "serializer", "]", "=", "(", "is_array", "(", "$", "callbacks", ")", "?", "$", "callbacks", ":", "[", "$", "callbacks", ",", "null", "]", ")", ";", "static", "::", "registerEnumType", "(", "$", "name", ",", "$", "constructor", ",", "$", "serializer", ")", ";", "}", "}" ]
Register a set of types with the provided constructor and serializer callables @param array $types An Array of name => constructor or alias => [ constructor, serializer ] @throws InvalidArgumentException @throws DBALException
[ "Register", "a", "set", "of", "types", "with", "the", "provided", "constructor", "and", "serializer", "callables" ]
479763bdd9abd4f1e6a9d2d1b3ba0d8d28815e52
https://github.com/dave-redfern/somnambulist-doctrine-enum-bridge/blob/479763bdd9abd4f1e6a9d2d1b3ba0d8d28815e52/src/EnumerationBridge.php#L67-L74
10,004
dave-redfern/somnambulist-doctrine-enum-bridge
src/EnumerationBridge.php
EnumerationBridge.registerEnumType
public static function registerEnumType($name, callable $constructor, callable $serializer = null) { if (static::hasType($name)) { return; } $serializer = $serializer ?? function ($value) { return ($value === null) ? null : (string)$value; }; // Register and customize the type static::addType($name, static::class); /** @var EnumerationBridge $type */ $type = static::getType($name); $type->name = $name; $type->constructor = $constructor; $type->serializer = $serializer; }
php
public static function registerEnumType($name, callable $constructor, callable $serializer = null) { if (static::hasType($name)) { return; } $serializer = $serializer ?? function ($value) { return ($value === null) ? null : (string)$value; }; // Register and customize the type static::addType($name, static::class); /** @var EnumerationBridge $type */ $type = static::getType($name); $type->name = $name; $type->constructor = $constructor; $type->serializer = $serializer; }
[ "public", "static", "function", "registerEnumType", "(", "$", "name", ",", "callable", "$", "constructor", ",", "callable", "$", "serializer", "=", "null", ")", "{", "if", "(", "static", "::", "hasType", "(", "$", "name", ")", ")", "{", "return", ";", "}", "$", "serializer", "=", "$", "serializer", "??", "function", "(", "$", "value", ")", "{", "return", "(", "$", "value", "===", "null", ")", "?", "null", ":", "(", "string", ")", "$", "value", ";", "}", ";", "// Register and customize the type", "static", "::", "addType", "(", "$", "name", ",", "static", "::", "class", ")", ";", "/** @var EnumerationBridge $type */", "$", "type", "=", "static", "::", "getType", "(", "$", "name", ")", ";", "$", "type", "->", "name", "=", "$", "name", ";", "$", "type", "->", "constructor", "=", "$", "constructor", ";", "$", "type", "->", "serializer", "=", "$", "serializer", ";", "}" ]
Registers an enumerable handler @param string $name @param callable $constructor Receives: value, enum name, platform @param callable $serializer Receives: value, enum name, platform @throws InvalidArgumentException @throws DBALException
[ "Registers", "an", "enumerable", "handler" ]
479763bdd9abd4f1e6a9d2d1b3ba0d8d28815e52
https://github.com/dave-redfern/somnambulist-doctrine-enum-bridge/blob/479763bdd9abd4f1e6a9d2d1b3ba0d8d28815e52/src/EnumerationBridge.php#L86-L102
10,005
elcodi/Template
Command/TemplatesLoadCommand.php
TemplatesLoadCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $formatter = $this->getHelper('formatter'); $templates = $this ->templateManager ->loadTemplates(); foreach ($templates as $template) { $formattedLine = $formatter->formatSection( 'OK', 'Template "' . $template['bundle'] . '" installed' ); $output->writeln($formattedLine); } }
php
protected function execute(InputInterface $input, OutputInterface $output) { $formatter = $this->getHelper('formatter'); $templates = $this ->templateManager ->loadTemplates(); foreach ($templates as $template) { $formattedLine = $formatter->formatSection( 'OK', 'Template "' . $template['bundle'] . '" installed' ); $output->writeln($formattedLine); } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "formatter", "=", "$", "this", "->", "getHelper", "(", "'formatter'", ")", ";", "$", "templates", "=", "$", "this", "->", "templateManager", "->", "loadTemplates", "(", ")", ";", "foreach", "(", "$", "templates", "as", "$", "template", ")", "{", "$", "formattedLine", "=", "$", "formatter", "->", "formatSection", "(", "'OK'", ",", "'Template \"'", ".", "$", "template", "[", "'bundle'", "]", ".", "'\" installed'", ")", ";", "$", "output", "->", "writeln", "(", "$", "formattedLine", ")", ";", "}", "}" ]
This command loads all the templates installed @param InputInterface $input The input interface @param OutputInterface $output The output interface @return void
[ "This", "command", "loads", "all", "the", "templates", "installed" ]
ffc19d5a0ac385364f04f93414e1192aaae120e2
https://github.com/elcodi/Template/blob/ffc19d5a0ac385364f04f93414e1192aaae120e2/Command/TemplatesLoadCommand.php#L68-L83
10,006
TechPromux/TechPromuxBaseBundle
Manager/BaseManager.php
BaseManager.throwException
public function throwException($message = '', $type = 'default') { switch ($type) { case 'access-denied': throw new AccessDeniedException($message); case 'not-found': throw new NotFoundHttpException($message); case 'runtime': throw new \RuntimeException($message); default: throw new \Exception($message); } }
php
public function throwException($message = '', $type = 'default') { switch ($type) { case 'access-denied': throw new AccessDeniedException($message); case 'not-found': throw new NotFoundHttpException($message); case 'runtime': throw new \RuntimeException($message); default: throw new \Exception($message); } }
[ "public", "function", "throwException", "(", "$", "message", "=", "''", ",", "$", "type", "=", "'default'", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'access-denied'", ":", "throw", "new", "AccessDeniedException", "(", "$", "message", ")", ";", "case", "'not-found'", ":", "throw", "new", "NotFoundHttpException", "(", "$", "message", ")", ";", "case", "'runtime'", ":", "throw", "new", "\\", "RuntimeException", "(", "$", "message", ")", ";", "default", ":", "throw", "new", "\\", "Exception", "(", "$", "message", ")", ";", "}", "}" ]
Throw an Exception @param string $type @param string $message @throws \RuntimeException @throws NotFoundHttpException @throws AccessDeniedException @throws \Exception
[ "Throw", "an", "Exception" ]
2569b84cf5c024fd908a13a0f129def19050acd2
https://github.com/TechPromux/TechPromuxBaseBundle/blob/2569b84cf5c024fd908a13a0f129def19050acd2/Manager/BaseManager.php#L55-L67
10,007
TechPromux/TechPromuxBaseBundle
Manager/BaseManager.php
BaseManager.addNamedParameter
protected function addNamedParameter($name, $value, $queryBuilder, $type = null) { $bound_suffix = '_' . (microtime(true) * 10000) . '_' . random_int(1000, 9999) . '_' . count($queryBuilder->getParameters()); $placeHolder = ":" . $name . $bound_suffix; $queryBuilder->setParameter(substr($placeHolder, 1), $value, $type); return $placeHolder; }
php
protected function addNamedParameter($name, $value, $queryBuilder, $type = null) { $bound_suffix = '_' . (microtime(true) * 10000) . '_' . random_int(1000, 9999) . '_' . count($queryBuilder->getParameters()); $placeHolder = ":" . $name . $bound_suffix; $queryBuilder->setParameter(substr($placeHolder, 1), $value, $type); return $placeHolder; }
[ "protected", "function", "addNamedParameter", "(", "$", "name", ",", "$", "value", ",", "$", "queryBuilder", ",", "$", "type", "=", "null", ")", "{", "$", "bound_suffix", "=", "'_'", ".", "(", "microtime", "(", "true", ")", "*", "10000", ")", ".", "'_'", ".", "random_int", "(", "1000", ",", "9999", ")", ".", "'_'", ".", "count", "(", "$", "queryBuilder", "->", "getParameters", "(", ")", ")", ";", "$", "placeHolder", "=", "\":\"", ".", "$", "name", ".", "$", "bound_suffix", ";", "$", "queryBuilder", "->", "setParameter", "(", "substr", "(", "$", "placeHolder", ",", "1", ")", ",", "$", "value", ",", "$", "type", ")", ";", "return", "$", "placeHolder", ";", "}" ]
Add a new parameter to queryBuilder @param string $name @param mixed $value @param QueryBuilder $queryBuilder @param mixed $type @return string
[ "Add", "a", "new", "parameter", "to", "queryBuilder" ]
2569b84cf5c024fd908a13a0f129def19050acd2
https://github.com/TechPromux/TechPromuxBaseBundle/blob/2569b84cf5c024fd908a13a0f129def19050acd2/Manager/BaseManager.php#L107-L113
10,008
TechPromux/TechPromuxBaseBundle
Manager/BaseManager.php
BaseManager.getResultFromQueryBuilder
protected function getResultFromQueryBuilder(\Doctrine\ORM\QueryBuilder $queryBuilder) { $query = $queryBuilder->getQuery(); $result = $query->getResult(); return $result; }
php
protected function getResultFromQueryBuilder(\Doctrine\ORM\QueryBuilder $queryBuilder) { $query = $queryBuilder->getQuery(); $result = $query->getResult(); return $result; }
[ "protected", "function", "getResultFromQueryBuilder", "(", "\\", "Doctrine", "\\", "ORM", "\\", "QueryBuilder", "$", "queryBuilder", ")", "{", "$", "query", "=", "$", "queryBuilder", "->", "getQuery", "(", ")", ";", "$", "result", "=", "$", "query", "->", "getResult", "(", ")", ";", "return", "$", "result", ";", "}" ]
Get result from execution of queryBuilder @param QueryBuilder $queryBuilder @return ArrayCollection
[ "Get", "result", "from", "execution", "of", "queryBuilder" ]
2569b84cf5c024fd908a13a0f129def19050acd2
https://github.com/TechPromux/TechPromuxBaseBundle/blob/2569b84cf5c024fd908a13a0f129def19050acd2/Manager/BaseManager.php#L122-L130
10,009
TechPromux/TechPromuxBaseBundle
Manager/BaseManager.php
BaseManager.getOneOrNullResultFromQueryBuilder
protected function getOneOrNullResultFromQueryBuilder(QueryBuilder $queryBuilder) { $query = $queryBuilder->getQuery(); $result = $query->getOneOrNullResult(); return $result; }
php
protected function getOneOrNullResultFromQueryBuilder(QueryBuilder $queryBuilder) { $query = $queryBuilder->getQuery(); $result = $query->getOneOrNullResult(); return $result; }
[ "protected", "function", "getOneOrNullResultFromQueryBuilder", "(", "QueryBuilder", "$", "queryBuilder", ")", "{", "$", "query", "=", "$", "queryBuilder", "->", "getQuery", "(", ")", ";", "$", "result", "=", "$", "query", "->", "getOneOrNullResult", "(", ")", ";", "return", "$", "result", ";", "}" ]
Get one result from execution of queryBuilder @param QueryBuilder $queryBuilder @return mixed;
[ "Get", "one", "result", "from", "execution", "of", "queryBuilder" ]
2569b84cf5c024fd908a13a0f129def19050acd2
https://github.com/TechPromux/TechPromuxBaseBundle/blob/2569b84cf5c024fd908a13a0f129def19050acd2/Manager/BaseManager.php#L139-L146
10,010
ekyna/CartBundle
Controller/CartController.php
CartController.informationsAction
public function informationsAction(Request $request) { if (null !== $redirect = $this->validateStep('information')) { return $redirect; } $cart = $this->getCart(); /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */ $user = $this->getUser(); if (null !== $user) { $cart ->setUser($user) ->setGender($user->getGender()) ->setFirstName($user->getFirstName()) ->setLastName($user->getLastName()) ->setEmail($user->getEmail()) ; } $form = $this->createForm('ekyna_cart_step_information', $cart); $form->handleRequest($request); if ($form->isValid()) { $event = new OrderEvent($cart); $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event); if (!$event->isPropagationStopped()) { if ($cart->requiresShipment()) { return $this->redirect($this->generateUrl('ekyna_cart_shipment')); } return $this->redirect($this->generateUrl('ekyna_cart_payment')); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirect($this->generateUrl('ekyna_cart_informations')); } return $this->render('EkynaCartBundle:Cart:informations.html.twig', [ 'form' => $form->createView(), 'cart' => $cart, 'user' => $user, ]); }
php
public function informationsAction(Request $request) { if (null !== $redirect = $this->validateStep('information')) { return $redirect; } $cart = $this->getCart(); /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */ $user = $this->getUser(); if (null !== $user) { $cart ->setUser($user) ->setGender($user->getGender()) ->setFirstName($user->getFirstName()) ->setLastName($user->getLastName()) ->setEmail($user->getEmail()) ; } $form = $this->createForm('ekyna_cart_step_information', $cart); $form->handleRequest($request); if ($form->isValid()) { $event = new OrderEvent($cart); $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event); if (!$event->isPropagationStopped()) { if ($cart->requiresShipment()) { return $this->redirect($this->generateUrl('ekyna_cart_shipment')); } return $this->redirect($this->generateUrl('ekyna_cart_payment')); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirect($this->generateUrl('ekyna_cart_informations')); } return $this->render('EkynaCartBundle:Cart:informations.html.twig', [ 'form' => $form->createView(), 'cart' => $cart, 'user' => $user, ]); }
[ "public", "function", "informationsAction", "(", "Request", "$", "request", ")", "{", "if", "(", "null", "!==", "$", "redirect", "=", "$", "this", "->", "validateStep", "(", "'information'", ")", ")", "{", "return", "$", "redirect", ";", "}", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "/** @var \\Ekyna\\Bundle\\UserBundle\\Model\\UserInterface $user */", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "null", "!==", "$", "user", ")", "{", "$", "cart", "->", "setUser", "(", "$", "user", ")", "->", "setGender", "(", "$", "user", "->", "getGender", "(", ")", ")", "->", "setFirstName", "(", "$", "user", "->", "getFirstName", "(", ")", ")", "->", "setLastName", "(", "$", "user", "->", "getLastName", "(", ")", ")", "->", "setEmail", "(", "$", "user", "->", "getEmail", "(", ")", ")", ";", "}", "$", "form", "=", "$", "this", "->", "createForm", "(", "'ekyna_cart_step_information'", ",", "$", "cart", ")", ";", "$", "form", "->", "handleRequest", "(", "$", "request", ")", ";", "if", "(", "$", "form", "->", "isValid", "(", ")", ")", "{", "$", "event", "=", "new", "OrderEvent", "(", "$", "cart", ")", ";", "$", "this", "->", "getDispatcher", "(", ")", "->", "dispatch", "(", "OrderEvents", "::", "CONTENT_CHANGE", ",", "$", "event", ")", ";", "if", "(", "!", "$", "event", "->", "isPropagationStopped", "(", ")", ")", "{", "if", "(", "$", "cart", "->", "requiresShipment", "(", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_shipment'", ")", ")", ";", "}", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_payment'", ")", ")", ";", "}", "else", "{", "$", "event", "->", "toFlashes", "(", "$", "this", "->", "getFlashBag", "(", ")", ")", ";", "}", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_informations'", ")", ")", ";", "}", "return", "$", "this", "->", "render", "(", "'EkynaCartBundle:Cart:informations.html.twig'", ",", "[", "'form'", "=>", "$", "form", "->", "createView", "(", ")", ",", "'cart'", "=>", "$", "cart", ",", "'user'", "=>", "$", "user", ",", "]", ")", ";", "}" ]
Informations action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
[ "Informations", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L64-L106
10,011
ekyna/CartBundle
Controller/CartController.php
CartController.shipmentAction
public function shipmentAction(Request $request) { if (null !== $redirect = $this->validateStep('shipment')) { return $redirect; } $cart = $this->getCart(); // Go to payment page if no shipment required if (!$cart->requiresShipment()) { return $this->redirect($this->generateUrl('ekyna_cart_payment')); } /* TODO $form = $this->createForm('ekyna_cart_shipment', $cart); $form->handleRequest($request); if ($form->isValid()) { $event = new OrderEvent($cart); $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event); if (!$event->isPropagationStopped()) { return $this->redirect($this->generateUrl('ekyna_cart_payment')); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirect($this->generateUrl('ekyna_cart_shipment')); }*/ return $this->render('EkynaCartBundle:Cart:shipment.html.twig', [ // 'form' => $form->createView(), // 'cart' => $cart, // 'user' => $user, ]); }
php
public function shipmentAction(Request $request) { if (null !== $redirect = $this->validateStep('shipment')) { return $redirect; } $cart = $this->getCart(); // Go to payment page if no shipment required if (!$cart->requiresShipment()) { return $this->redirect($this->generateUrl('ekyna_cart_payment')); } /* TODO $form = $this->createForm('ekyna_cart_shipment', $cart); $form->handleRequest($request); if ($form->isValid()) { $event = new OrderEvent($cart); $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event); if (!$event->isPropagationStopped()) { return $this->redirect($this->generateUrl('ekyna_cart_payment')); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirect($this->generateUrl('ekyna_cart_shipment')); }*/ return $this->render('EkynaCartBundle:Cart:shipment.html.twig', [ // 'form' => $form->createView(), // 'cart' => $cart, // 'user' => $user, ]); }
[ "public", "function", "shipmentAction", "(", "Request", "$", "request", ")", "{", "if", "(", "null", "!==", "$", "redirect", "=", "$", "this", "->", "validateStep", "(", "'shipment'", ")", ")", "{", "return", "$", "redirect", ";", "}", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "// Go to payment page if no shipment required", "if", "(", "!", "$", "cart", "->", "requiresShipment", "(", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_payment'", ")", ")", ";", "}", "/* TODO\n $form = $this->createForm('ekyna_cart_shipment', $cart);\n\n $form->handleRequest($request);\n if ($form->isValid()) {\n $event = new OrderEvent($cart);\n $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event);\n if (!$event->isPropagationStopped()) {\n return $this->redirect($this->generateUrl('ekyna_cart_payment'));\n } else {\n $event->toFlashes($this->getFlashBag());\n }\n return $this->redirect($this->generateUrl('ekyna_cart_shipment'));\n }*/", "return", "$", "this", "->", "render", "(", "'EkynaCartBundle:Cart:shipment.html.twig'", ",", "[", "// 'form' => $form->createView(),", "// 'cart' => $cart,", "// \t 'user' => $user,", "]", ")", ";", "}" ]
Shipment action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
[ "Shipment", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L114-L147
10,012
ekyna/CartBundle
Controller/CartController.php
CartController.paymentAction
public function paymentAction(Request $request) { if (null !== $redirect = $this->validateStep('payment')) { return $redirect; } $cart = $this->getCart(); $amount = $this ->get('ekyna_order.order.calculator') ->calculateOrderRemainingTotal($cart) ; $paymentClass = $this->container->getParameter('ekyna_order.order_payment.class'); /** @var \Ekyna\Component\Sale\Order\OrderPaymentInterface $payment */ $payment = new $paymentClass; $payment->setAmount($amount); $cart->addPayment($payment); $form = $this->createForm('ekyna_cart_payment', $payment); $form->handleRequest($request); if ($form->isValid()) { $event = new PaymentEvent($payment); $this->getDispatcher()->dispatch(PaymentEvents::PREPARE, $event); if ($event->isPropagationStopped()) { $event->toFlashes($this->getFlashBag()); } elseif (null !== $response = $event->getResponse()) { return $response; } } return $this->render('EkynaCartBundle:Cart:payment.html.twig', [ 'cart' => $cart, 'form' => $form->createView(), ]); }
php
public function paymentAction(Request $request) { if (null !== $redirect = $this->validateStep('payment')) { return $redirect; } $cart = $this->getCart(); $amount = $this ->get('ekyna_order.order.calculator') ->calculateOrderRemainingTotal($cart) ; $paymentClass = $this->container->getParameter('ekyna_order.order_payment.class'); /** @var \Ekyna\Component\Sale\Order\OrderPaymentInterface $payment */ $payment = new $paymentClass; $payment->setAmount($amount); $cart->addPayment($payment); $form = $this->createForm('ekyna_cart_payment', $payment); $form->handleRequest($request); if ($form->isValid()) { $event = new PaymentEvent($payment); $this->getDispatcher()->dispatch(PaymentEvents::PREPARE, $event); if ($event->isPropagationStopped()) { $event->toFlashes($this->getFlashBag()); } elseif (null !== $response = $event->getResponse()) { return $response; } } return $this->render('EkynaCartBundle:Cart:payment.html.twig', [ 'cart' => $cart, 'form' => $form->createView(), ]); }
[ "public", "function", "paymentAction", "(", "Request", "$", "request", ")", "{", "if", "(", "null", "!==", "$", "redirect", "=", "$", "this", "->", "validateStep", "(", "'payment'", ")", ")", "{", "return", "$", "redirect", ";", "}", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "$", "amount", "=", "$", "this", "->", "get", "(", "'ekyna_order.order.calculator'", ")", "->", "calculateOrderRemainingTotal", "(", "$", "cart", ")", ";", "$", "paymentClass", "=", "$", "this", "->", "container", "->", "getParameter", "(", "'ekyna_order.order_payment.class'", ")", ";", "/** @var \\Ekyna\\Component\\Sale\\Order\\OrderPaymentInterface $payment */", "$", "payment", "=", "new", "$", "paymentClass", ";", "$", "payment", "->", "setAmount", "(", "$", "amount", ")", ";", "$", "cart", "->", "addPayment", "(", "$", "payment", ")", ";", "$", "form", "=", "$", "this", "->", "createForm", "(", "'ekyna_cart_payment'", ",", "$", "payment", ")", ";", "$", "form", "->", "handleRequest", "(", "$", "request", ")", ";", "if", "(", "$", "form", "->", "isValid", "(", ")", ")", "{", "$", "event", "=", "new", "PaymentEvent", "(", "$", "payment", ")", ";", "$", "this", "->", "getDispatcher", "(", ")", "->", "dispatch", "(", "PaymentEvents", "::", "PREPARE", ",", "$", "event", ")", ";", "if", "(", "$", "event", "->", "isPropagationStopped", "(", ")", ")", "{", "$", "event", "->", "toFlashes", "(", "$", "this", "->", "getFlashBag", "(", ")", ")", ";", "}", "elseif", "(", "null", "!==", "$", "response", "=", "$", "event", "->", "getResponse", "(", ")", ")", "{", "return", "$", "response", ";", "}", "}", "return", "$", "this", "->", "render", "(", "'EkynaCartBundle:Cart:payment.html.twig'", ",", "[", "'cart'", "=>", "$", "cart", ",", "'form'", "=>", "$", "form", "->", "createView", "(", ")", ",", "]", ")", ";", "}" ]
Payment action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
[ "Payment", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L155-L191
10,013
ekyna/CartBundle
Controller/CartController.php
CartController.confirmationAction
public function confirmationAction(Request $request) { /** @var \Ekyna\Component\Sale\Order\OrderInterface $order */ $order = $this->get('ekyna_order.order.repository')->findOneByKey( $request->attributes->get('orderKey') ); if (null === $order) { throw new NotFoundHttpException('Order not found.'); } if (null !== $user = $order->getUser()) { if ($user !== $this->getUser()) { throw new AccessDeniedHttpException('You are not allowed to view this resource.'); } } if (null === $payment = $order->findPaymentById($request->attributes->get('paymentId'))) { throw new NotFoundHttpException('Payment not found.'); } /** @var \Ekyna\Bundle\PaymentBundle\Model\MethodInterface $method */ $method = $payment->getMethod(); $message = $method->getMessageByState($payment->getState()); if (null === $message || 0 == strlen($message->getFlash())) { $message = null; } return $this->render('EkynaCartBundle:Cart:confirmation.html.twig', [ 'order' => $order, 'payment' => $payment, 'message' => $message, ]); }
php
public function confirmationAction(Request $request) { /** @var \Ekyna\Component\Sale\Order\OrderInterface $order */ $order = $this->get('ekyna_order.order.repository')->findOneByKey( $request->attributes->get('orderKey') ); if (null === $order) { throw new NotFoundHttpException('Order not found.'); } if (null !== $user = $order->getUser()) { if ($user !== $this->getUser()) { throw new AccessDeniedHttpException('You are not allowed to view this resource.'); } } if (null === $payment = $order->findPaymentById($request->attributes->get('paymentId'))) { throw new NotFoundHttpException('Payment not found.'); } /** @var \Ekyna\Bundle\PaymentBundle\Model\MethodInterface $method */ $method = $payment->getMethod(); $message = $method->getMessageByState($payment->getState()); if (null === $message || 0 == strlen($message->getFlash())) { $message = null; } return $this->render('EkynaCartBundle:Cart:confirmation.html.twig', [ 'order' => $order, 'payment' => $payment, 'message' => $message, ]); }
[ "public", "function", "confirmationAction", "(", "Request", "$", "request", ")", "{", "/** @var \\Ekyna\\Component\\Sale\\Order\\OrderInterface $order */", "$", "order", "=", "$", "this", "->", "get", "(", "'ekyna_order.order.repository'", ")", "->", "findOneByKey", "(", "$", "request", "->", "attributes", "->", "get", "(", "'orderKey'", ")", ")", ";", "if", "(", "null", "===", "$", "order", ")", "{", "throw", "new", "NotFoundHttpException", "(", "'Order not found.'", ")", ";", "}", "if", "(", "null", "!==", "$", "user", "=", "$", "order", "->", "getUser", "(", ")", ")", "{", "if", "(", "$", "user", "!==", "$", "this", "->", "getUser", "(", ")", ")", "{", "throw", "new", "AccessDeniedHttpException", "(", "'You are not allowed to view this resource.'", ")", ";", "}", "}", "if", "(", "null", "===", "$", "payment", "=", "$", "order", "->", "findPaymentById", "(", "$", "request", "->", "attributes", "->", "get", "(", "'paymentId'", ")", ")", ")", "{", "throw", "new", "NotFoundHttpException", "(", "'Payment not found.'", ")", ";", "}", "/** @var \\Ekyna\\Bundle\\PaymentBundle\\Model\\MethodInterface $method */", "$", "method", "=", "$", "payment", "->", "getMethod", "(", ")", ";", "$", "message", "=", "$", "method", "->", "getMessageByState", "(", "$", "payment", "->", "getState", "(", ")", ")", ";", "if", "(", "null", "===", "$", "message", "||", "0", "==", "strlen", "(", "$", "message", "->", "getFlash", "(", ")", ")", ")", "{", "$", "message", "=", "null", ";", "}", "return", "$", "this", "->", "render", "(", "'EkynaCartBundle:Cart:confirmation.html.twig'", ",", "[", "'order'", "=>", "$", "order", ",", "'payment'", "=>", "$", "payment", ",", "'message'", "=>", "$", "message", ",", "]", ")", ";", "}" ]
Confirmation action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
[ "Confirmation", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L199-L232
10,014
ekyna/CartBundle
Controller/CartController.php
CartController.resetAction
public function resetAction(Request $request) { $cart = $this->getCart(); $event = new OrderEvent($cart); $this->get('ekyna_order.order.operator')->delete($event, true); if (!$event->hasErrors()) { $this->addFlash('ekyna_cart.message.reset'); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirectAfterContentChange($request); }
php
public function resetAction(Request $request) { $cart = $this->getCart(); $event = new OrderEvent($cart); $this->get('ekyna_order.order.operator')->delete($event, true); if (!$event->hasErrors()) { $this->addFlash('ekyna_cart.message.reset'); } else { $event->toFlashes($this->getFlashBag()); } return $this->redirectAfterContentChange($request); }
[ "public", "function", "resetAction", "(", "Request", "$", "request", ")", "{", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "$", "event", "=", "new", "OrderEvent", "(", "$", "cart", ")", ";", "$", "this", "->", "get", "(", "'ekyna_order.order.operator'", ")", "->", "delete", "(", "$", "event", ",", "true", ")", ";", "if", "(", "!", "$", "event", "->", "hasErrors", "(", ")", ")", "{", "$", "this", "->", "addFlash", "(", "'ekyna_cart.message.reset'", ")", ";", "}", "else", "{", "$", "event", "->", "toFlashes", "(", "$", "this", "->", "getFlashBag", "(", ")", ")", ";", "}", "return", "$", "this", "->", "redirectAfterContentChange", "(", "$", "request", ")", ";", "}" ]
Reset action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse
[ "Reset", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L240-L252
10,015
ekyna/CartBundle
Controller/CartController.php
CartController.removeItemAction
public function removeItemAction(Request $request) { $cart = $this->getCart(); $item = $this->getDoctrine() ->getRepository('EkynaOrderBundle:OrderItem') ->findOneBy([ 'id' => $request->attributes->get('itemId'), 'orderId' => $cart->getId(), ]); if (null === $item) { throw new NotFoundHttpException($this->getTranslator()->trans('ekyna_cart.message.item_not_found')); } $event = new OrderItemEvent($cart, $item); $this->getDispatcher()->dispatch(OrderItemEvents::REMOVE, $event); if (!$event->isPropagationStopped()) { $message = 'ekyna_cart.message.item_remove.success'; $type = 'success'; } else { $message = 'ekyna_cart.message.item_remove.failure'; $type = 'danger'; } $this->addFlash($this->getTranslator()->trans($message, [ '{{ name }}' => $item->getDesignation(), '{{ path }}' => $this->generateUrl('ekyna_cart_index'), ]), $type); if ($request->isXmlHttpRequest()) { // TODO return new Response(); } return $this->redirectAfterContentChange($request); }
php
public function removeItemAction(Request $request) { $cart = $this->getCart(); $item = $this->getDoctrine() ->getRepository('EkynaOrderBundle:OrderItem') ->findOneBy([ 'id' => $request->attributes->get('itemId'), 'orderId' => $cart->getId(), ]); if (null === $item) { throw new NotFoundHttpException($this->getTranslator()->trans('ekyna_cart.message.item_not_found')); } $event = new OrderItemEvent($cart, $item); $this->getDispatcher()->dispatch(OrderItemEvents::REMOVE, $event); if (!$event->isPropagationStopped()) { $message = 'ekyna_cart.message.item_remove.success'; $type = 'success'; } else { $message = 'ekyna_cart.message.item_remove.failure'; $type = 'danger'; } $this->addFlash($this->getTranslator()->trans($message, [ '{{ name }}' => $item->getDesignation(), '{{ path }}' => $this->generateUrl('ekyna_cart_index'), ]), $type); if ($request->isXmlHttpRequest()) { // TODO return new Response(); } return $this->redirectAfterContentChange($request); }
[ "public", "function", "removeItemAction", "(", "Request", "$", "request", ")", "{", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "$", "item", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getRepository", "(", "'EkynaOrderBundle:OrderItem'", ")", "->", "findOneBy", "(", "[", "'id'", "=>", "$", "request", "->", "attributes", "->", "get", "(", "'itemId'", ")", ",", "'orderId'", "=>", "$", "cart", "->", "getId", "(", ")", ",", "]", ")", ";", "if", "(", "null", "===", "$", "item", ")", "{", "throw", "new", "NotFoundHttpException", "(", "$", "this", "->", "getTranslator", "(", ")", "->", "trans", "(", "'ekyna_cart.message.item_not_found'", ")", ")", ";", "}", "$", "event", "=", "new", "OrderItemEvent", "(", "$", "cart", ",", "$", "item", ")", ";", "$", "this", "->", "getDispatcher", "(", ")", "->", "dispatch", "(", "OrderItemEvents", "::", "REMOVE", ",", "$", "event", ")", ";", "if", "(", "!", "$", "event", "->", "isPropagationStopped", "(", ")", ")", "{", "$", "message", "=", "'ekyna_cart.message.item_remove.success'", ";", "$", "type", "=", "'success'", ";", "}", "else", "{", "$", "message", "=", "'ekyna_cart.message.item_remove.failure'", ";", "$", "type", "=", "'danger'", ";", "}", "$", "this", "->", "addFlash", "(", "$", "this", "->", "getTranslator", "(", ")", "->", "trans", "(", "$", "message", ",", "[", "'{{ name }}'", "=>", "$", "item", "->", "getDesignation", "(", ")", ",", "'{{ path }}'", "=>", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_index'", ")", ",", "]", ")", ",", "$", "type", ")", ";", "if", "(", "$", "request", "->", "isXmlHttpRequest", "(", ")", ")", "{", "// TODO", "return", "new", "Response", "(", ")", ";", "}", "return", "$", "this", "->", "redirectAfterContentChange", "(", "$", "request", ")", ";", "}" ]
Remove item action. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse|Response @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
[ "Remove", "item", "action", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L261-L295
10,016
ekyna/CartBundle
Controller/CartController.php
CartController.validateStep
protected function validateStep($step) { $stepGroups = [ 'information' => ['ekyna_cart_index', ['Default', 'Cart']], 'shipment' => ['ekyna_cart_informations', ['Default', 'Cart', 'Information']], 'payment' => ['ekyna_cart_shipment', ['Default', 'Cart', 'Information', 'Shipment']], ]; if (!array_key_exists($step, $stepGroups)) { throw new \InvalidArgumentException(sprintf('Undefined step "%s".', $step)); } $cart = $this->getCart(); $errorList = $this->get('validator')->validate($cart, $stepGroups[$step][1]); if (0 != $errorList->count()) { return $this->redirect($this->generateUrl($stepGroups[$step][0])); } return null; }
php
protected function validateStep($step) { $stepGroups = [ 'information' => ['ekyna_cart_index', ['Default', 'Cart']], 'shipment' => ['ekyna_cart_informations', ['Default', 'Cart', 'Information']], 'payment' => ['ekyna_cart_shipment', ['Default', 'Cart', 'Information', 'Shipment']], ]; if (!array_key_exists($step, $stepGroups)) { throw new \InvalidArgumentException(sprintf('Undefined step "%s".', $step)); } $cart = $this->getCart(); $errorList = $this->get('validator')->validate($cart, $stepGroups[$step][1]); if (0 != $errorList->count()) { return $this->redirect($this->generateUrl($stepGroups[$step][0])); } return null; }
[ "protected", "function", "validateStep", "(", "$", "step", ")", "{", "$", "stepGroups", "=", "[", "'information'", "=>", "[", "'ekyna_cart_index'", ",", "[", "'Default'", ",", "'Cart'", "]", "]", ",", "'shipment'", "=>", "[", "'ekyna_cart_informations'", ",", "[", "'Default'", ",", "'Cart'", ",", "'Information'", "]", "]", ",", "'payment'", "=>", "[", "'ekyna_cart_shipment'", ",", "[", "'Default'", ",", "'Cart'", ",", "'Information'", ",", "'Shipment'", "]", "]", ",", "]", ";", "if", "(", "!", "array_key_exists", "(", "$", "step", ",", "$", "stepGroups", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Undefined step \"%s\".'", ",", "$", "step", ")", ")", ";", "}", "$", "cart", "=", "$", "this", "->", "getCart", "(", ")", ";", "$", "errorList", "=", "$", "this", "->", "get", "(", "'validator'", ")", "->", "validate", "(", "$", "cart", ",", "$", "stepGroups", "[", "$", "step", "]", "[", "1", "]", ")", ";", "if", "(", "0", "!=", "$", "errorList", "->", "count", "(", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "$", "stepGroups", "[", "$", "step", "]", "[", "0", "]", ")", ")", ";", "}", "return", "null", ";", "}" ]
Validates the cart for the given step name. @param string $step @return null|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Validates", "the", "cart", "for", "the", "given", "step", "name", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L303-L321
10,017
ekyna/CartBundle
Controller/CartController.php
CartController.securityCheck
protected function securityCheck(Request $request) { if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $request->getSession()->set('_ekyna.login_success.target_path', 'ekyna_cart_informations'); return $this->redirect($this->generateUrl('fos_user_security_login')); } return null; }
php
protected function securityCheck(Request $request) { if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $request->getSession()->set('_ekyna.login_success.target_path', 'ekyna_cart_informations'); return $this->redirect($this->generateUrl('fos_user_security_login')); } return null; }
[ "protected", "function", "securityCheck", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "this", "->", "get", "(", "'security.authorization_checker'", ")", "->", "isGranted", "(", "'IS_AUTHENTICATED_REMEMBERED'", ")", ")", "{", "$", "request", "->", "getSession", "(", ")", "->", "set", "(", "'_ekyna.login_success.target_path'", ",", "'ekyna_cart_informations'", ")", ";", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'fos_user_security_login'", ")", ")", ";", "}", "return", "null", ";", "}" ]
Check that user is logged. @param Request $request @return null|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Check", "that", "user", "is", "logged", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L329-L336
10,018
ekyna/CartBundle
Controller/CartController.php
CartController.redirectAfterContentChange
protected function redirectAfterContentChange(Request $request) { if (null !== $referer = $request->headers->get('referer', null)) { return $this->redirect($referer); } return $this->redirect($this->generateUrl('ekyna_cart_index')); }
php
protected function redirectAfterContentChange(Request $request) { if (null !== $referer = $request->headers->get('referer', null)) { return $this->redirect($referer); } return $this->redirect($this->generateUrl('ekyna_cart_index')); }
[ "protected", "function", "redirectAfterContentChange", "(", "Request", "$", "request", ")", "{", "if", "(", "null", "!==", "$", "referer", "=", "$", "request", "->", "headers", "->", "get", "(", "'referer'", ",", "null", ")", ")", "{", "return", "$", "this", "->", "redirect", "(", "$", "referer", ")", ";", "}", "return", "$", "this", "->", "redirect", "(", "$", "this", "->", "generateUrl", "(", "'ekyna_cart_index'", ")", ")", ";", "}" ]
Redirects after order content changed. @param Request $request @return \Symfony\Component\HttpFoundation\RedirectResponse
[ "Redirects", "after", "order", "content", "changed", "." ]
c486af3d027873c81c7b61ef71980e8062c3dddd
https://github.com/ekyna/CartBundle/blob/c486af3d027873c81c7b61ef71980e8062c3dddd/Controller/CartController.php#L344-L351
10,019
las93/attila
Attila/core/Model.php
Model.find
public function find($oEntityCriteria) { $this->_checkEntity($oEntityCriteria); $aEntity = get_object_vars(LibEntity::getRealEntity($oEntityCriteria)); $sPrimaryKeyName = LibEntity::getPrimaryKeyName($oEntityCriteria); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where(array($sPrimaryKeyName => $aEntity[$sPrimaryKeyName])) ->load(); if ($aResults) { return $aResults[0]; } if ($this->_isFilter()) { foreach ($aResults as $iKey => $oValue) { $aResults[$iKey] = $this->_applyFilter($oValue); } } return $aResults; }
php
public function find($oEntityCriteria) { $this->_checkEntity($oEntityCriteria); $aEntity = get_object_vars(LibEntity::getRealEntity($oEntityCriteria)); $sPrimaryKeyName = LibEntity::getPrimaryKeyName($oEntityCriteria); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where(array($sPrimaryKeyName => $aEntity[$sPrimaryKeyName])) ->load(); if ($aResults) { return $aResults[0]; } if ($this->_isFilter()) { foreach ($aResults as $iKey => $oValue) { $aResults[$iKey] = $this->_applyFilter($oValue); } } return $aResults; }
[ "public", "function", "find", "(", "$", "oEntityCriteria", ")", "{", "$", "this", "->", "_checkEntity", "(", "$", "oEntityCriteria", ")", ";", "$", "aEntity", "=", "get_object_vars", "(", "LibEntity", "::", "getRealEntity", "(", "$", "oEntityCriteria", ")", ")", ";", "$", "sPrimaryKeyName", "=", "LibEntity", "::", "getPrimaryKeyName", "(", "$", "oEntityCriteria", ")", ";", "$", "aResults", "=", "$", "this", "->", "orm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "this", "->", "_sTableName", ")", "->", "where", "(", "array", "(", "$", "sPrimaryKeyName", "=>", "$", "aEntity", "[", "$", "sPrimaryKeyName", "]", ")", ")", "->", "load", "(", ")", ";", "if", "(", "$", "aResults", ")", "{", "return", "$", "aResults", "[", "0", "]", ";", "}", "if", "(", "$", "this", "->", "_isFilter", "(", ")", ")", "{", "foreach", "(", "$", "aResults", "as", "$", "iKey", "=>", "$", "oValue", ")", "{", "$", "aResults", "[", "$", "iKey", "]", "=", "$", "this", "->", "_applyFilter", "(", "$", "oValue", ")", ";", "}", "}", "return", "$", "aResults", ";", "}" ]
classic method to find an entity @access public @param object $oEntityCriteria @return array
[ "classic", "method", "to", "find", "an", "entity" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L130-L154
10,020
las93/attila
Attila/core/Model.php
Model.findOneBy
public function findOneBy(array $aArguments) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where($aArguments) ->limit(1) ->load(false, $sEntityNamespace); if (isset($aResults[0]) && $this->_isFilter()) { $aResults[0] = $this->_applyFilter($aResults[0]); } if (isset($aResults[0])) { return $aResults[0]; } else { return false; } }
php
public function findOneBy(array $aArguments) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where($aArguments) ->limit(1) ->load(false, $sEntityNamespace); if (isset($aResults[0]) && $this->_isFilter()) { $aResults[0] = $this->_applyFilter($aResults[0]); } if (isset($aResults[0])) { return $aResults[0]; } else { return false; } }
[ "public", "function", "findOneBy", "(", "array", "$", "aArguments", ")", "{", "$", "sEntityNamespace", "=", "preg_replace", "(", "'/^(.*)Model\\\\\\\\.+$/'", ",", "'$1Entity\\\\'", ",", "get_called_class", "(", ")", ")", ";", "$", "aResults", "=", "$", "this", "->", "orm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "this", "->", "_sTableName", ")", "->", "where", "(", "$", "aArguments", ")", "->", "limit", "(", "1", ")", "->", "load", "(", "false", ",", "$", "sEntityNamespace", ")", ";", "if", "(", "isset", "(", "$", "aResults", "[", "0", "]", ")", "&&", "$", "this", "->", "_isFilter", "(", ")", ")", "{", "$", "aResults", "[", "0", "]", "=", "$", "this", "->", "_applyFilter", "(", "$", "aResults", "[", "0", "]", ")", ";", "}", "if", "(", "isset", "(", "$", "aResults", "[", "0", "]", ")", ")", "{", "return", "$", "aResults", "[", "0", "]", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
return an entity that it is found with the arguments @access public @param array $aArguments @return object @example $oModel->findOneBy(array('id' => 12);
[ "return", "an", "entity", "that", "it", "is", "found", "with", "the", "arguments" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L292-L307
10,021
las93/attila
Attila/core/Model.php
Model.findOrderBy
public function findOrderBy(array $aArguments) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->orderBy($aArguments) ->load(false, $sEntityNamespace); if ($this->_isFilter()) { foreach ($aResults as $iKey => $oValue) { $aResults[$iKey] = $this->_applyFilter($oValue); } } return $aResults; }
php
public function findOrderBy(array $aArguments) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->orderBy($aArguments) ->load(false, $sEntityNamespace); if ($this->_isFilter()) { foreach ($aResults as $iKey => $oValue) { $aResults[$iKey] = $this->_applyFilter($oValue); } } return $aResults; }
[ "public", "function", "findOrderBy", "(", "array", "$", "aArguments", ")", "{", "$", "sEntityNamespace", "=", "preg_replace", "(", "'/^(.*)Model\\\\\\\\.+$/'", ",", "'$1Entity\\\\'", ",", "get_called_class", "(", ")", ")", ";", "$", "aResults", "=", "$", "this", "->", "orm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "this", "->", "_sTableName", ")", "->", "orderBy", "(", "$", "aArguments", ")", "->", "load", "(", "false", ",", "$", "sEntityNamespace", ")", ";", "if", "(", "$", "this", "->", "_isFilter", "(", ")", ")", "{", "foreach", "(", "$", "aResults", "as", "$", "iKey", "=>", "$", "oValue", ")", "{", "$", "aResults", "[", "$", "iKey", "]", "=", "$", "this", "->", "_applyFilter", "(", "$", "oValue", ")", ";", "}", "}", "return", "$", "aResults", ";", "}" ]
return list of entities that they are found with the arguments @access public @param array $aArguments @return array @example $oModel->findOrderBy(array('id DESC');
[ "return", "list", "of", "entities", "that", "they", "are", "found", "with", "the", "arguments" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L373-L392
10,022
las93/attila
Attila/core/Model.php
Model.getLastRow
public function getLastRow() { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->orderBy(array(LibEntity::getPrimaryKeyName($this->entity) => 'DESC')) ->limit(1) ->load(false, $sEntityNamespace); if (isset($aResults[0]) && $this->_isFilter()) { $aResults[0] = $this->_applyFilter($aResults[0]); } return $aResults[0]; }
php
public function getLastRow() { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $aResults = $this->orm ->select(array('*')) ->from($this->_sTableName) ->orderBy(array(LibEntity::getPrimaryKeyName($this->entity) => 'DESC')) ->limit(1) ->load(false, $sEntityNamespace); if (isset($aResults[0]) && $this->_isFilter()) { $aResults[0] = $this->_applyFilter($aResults[0]); } return $aResults[0]; }
[ "public", "function", "getLastRow", "(", ")", "{", "$", "sEntityNamespace", "=", "preg_replace", "(", "'/^(.*)Model\\\\\\\\.+$/'", ",", "'$1Entity\\\\'", ",", "get_called_class", "(", ")", ")", ";", "$", "aResults", "=", "$", "this", "->", "orm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "this", "->", "_sTableName", ")", "->", "orderBy", "(", "array", "(", "LibEntity", "::", "getPrimaryKeyName", "(", "$", "this", "->", "entity", ")", "=>", "'DESC'", ")", ")", "->", "limit", "(", "1", ")", "->", "load", "(", "false", ",", "$", "sEntityNamespace", ")", ";", "if", "(", "isset", "(", "$", "aResults", "[", "0", "]", ")", "&&", "$", "this", "->", "_isFilter", "(", ")", ")", "{", "$", "aResults", "[", "0", "]", "=", "$", "this", "->", "_applyFilter", "(", "$", "aResults", "[", "0", "]", ")", ";", "}", "return", "$", "aResults", "[", "0", "]", ";", "}" ]
get last row @access public @return object
[ "get", "last", "row" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L516-L530
10,023
las93/attila
Attila/core/Model.php
Model.insertAndGet
public function insertAndGet($oEntity) { $iResult = $this->insert($oEntity); if ($iResult) { return $this->getLastRow(); } return $iResult; }
php
public function insertAndGet($oEntity) { $iResult = $this->insert($oEntity); if ($iResult) { return $this->getLastRow(); } return $iResult; }
[ "public", "function", "insertAndGet", "(", "$", "oEntity", ")", "{", "$", "iResult", "=", "$", "this", "->", "insert", "(", "$", "oEntity", ")", ";", "if", "(", "$", "iResult", ")", "{", "return", "$", "this", "->", "getLastRow", "(", ")", ";", "}", "return", "$", "iResult", ";", "}" ]
save Entity and get it @access public @param object $oEntity @return int|object
[ "save", "Entity", "and", "get", "it" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L539-L546
10,024
las93/attila
Attila/core/Model.php
Model.updateAndGet
public function updateAndGet($oEntity) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $mResult = $this->update($oEntity); if ($result) { $aEntity = get_object_vars(LibEntity::getRealEntity($oEntity)); $mPrimaryKey = LibEntity::getPrimaryKeyName($aEntity); $mResult = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where(array($mPrimaryKey => $aEntity[$mPrimaryKey])) ->load(false, $sEntityNamespace); if ($this->_isFilter()) { foreach ($mResult as $iKey => $oValue) { $mResult[$iKey] = $this->_applyFilter($oValue); } } } return $mResult; }
php
public function updateAndGet($oEntity) { $sEntityNamespace = preg_replace('/^(.*)Model\\\\.+$/', '$1Entity\\', get_called_class()); $mResult = $this->update($oEntity); if ($result) { $aEntity = get_object_vars(LibEntity::getRealEntity($oEntity)); $mPrimaryKey = LibEntity::getPrimaryKeyName($aEntity); $mResult = $this->orm ->select(array('*')) ->from($this->_sTableName) ->where(array($mPrimaryKey => $aEntity[$mPrimaryKey])) ->load(false, $sEntityNamespace); if ($this->_isFilter()) { foreach ($mResult as $iKey => $oValue) { $mResult[$iKey] = $this->_applyFilter($oValue); } } } return $mResult; }
[ "public", "function", "updateAndGet", "(", "$", "oEntity", ")", "{", "$", "sEntityNamespace", "=", "preg_replace", "(", "'/^(.*)Model\\\\\\\\.+$/'", ",", "'$1Entity\\\\'", ",", "get_called_class", "(", ")", ")", ";", "$", "mResult", "=", "$", "this", "->", "update", "(", "$", "oEntity", ")", ";", "if", "(", "$", "result", ")", "{", "$", "aEntity", "=", "get_object_vars", "(", "LibEntity", "::", "getRealEntity", "(", "$", "oEntity", ")", ")", ";", "$", "mPrimaryKey", "=", "LibEntity", "::", "getPrimaryKeyName", "(", "$", "aEntity", ")", ";", "$", "mResult", "=", "$", "this", "->", "orm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "this", "->", "_sTableName", ")", "->", "where", "(", "array", "(", "$", "mPrimaryKey", "=>", "$", "aEntity", "[", "$", "mPrimaryKey", "]", ")", ")", "->", "load", "(", "false", ",", "$", "sEntityNamespace", ")", ";", "if", "(", "$", "this", "->", "_isFilter", "(", ")", ")", "{", "foreach", "(", "$", "mResult", "as", "$", "iKey", "=>", "$", "oValue", ")", "{", "$", "mResult", "[", "$", "iKey", "]", "=", "$", "this", "->", "_applyFilter", "(", "$", "oValue", ")", ";", "}", "}", "}", "return", "$", "mResult", ";", "}" ]
update Entity and get it @access public @param object $oEntityCriteria @return mixed
[ "update", "Entity", "and", "get", "it" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L555-L582
10,025
las93/attila
Attila/core/Model.php
Model.delete
public function delete($oEntityCriteria) { $this->_checkEntity($oEntityCriteria); $aEntity = LibEntity::getAllEntity($oEntityCriteria, true); $this->orm ->delete($this->_sTableName) ->where($aEntity) ->save(); return $this; }
php
public function delete($oEntityCriteria) { $this->_checkEntity($oEntityCriteria); $aEntity = LibEntity::getAllEntity($oEntityCriteria, true); $this->orm ->delete($this->_sTableName) ->where($aEntity) ->save(); return $this; }
[ "public", "function", "delete", "(", "$", "oEntityCriteria", ")", "{", "$", "this", "->", "_checkEntity", "(", "$", "oEntityCriteria", ")", ";", "$", "aEntity", "=", "LibEntity", "::", "getAllEntity", "(", "$", "oEntityCriteria", ",", "true", ")", ";", "$", "this", "->", "orm", "->", "delete", "(", "$", "this", "->", "_sTableName", ")", "->", "where", "(", "$", "aEntity", ")", "->", "save", "(", ")", ";", "return", "$", "this", ";", "}" ]
classic method to delete one entities @access public @param object $oEntityCriteria @return object
[ "classic", "method", "to", "delete", "one", "entities" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L591-L603
10,026
las93/attila
Attila/core/Model.php
Model.truncate
public function truncate() { $aClass = explode('\\', get_called_class()); $sClassName = $aClass[count($aClass) - 1]; $this->orm ->truncate($sClassName) ->save(); return $this; }
php
public function truncate() { $aClass = explode('\\', get_called_class()); $sClassName = $aClass[count($aClass) - 1]; $this->orm ->truncate($sClassName) ->save(); return $this; }
[ "public", "function", "truncate", "(", ")", "{", "$", "aClass", "=", "explode", "(", "'\\\\'", ",", "get_called_class", "(", ")", ")", ";", "$", "sClassName", "=", "$", "aClass", "[", "count", "(", "$", "aClass", ")", "-", "1", "]", ";", "$", "this", "->", "orm", "->", "truncate", "(", "$", "sClassName", ")", "->", "save", "(", ")", ";", "return", "$", "this", ";", "}" ]
classic method to truncate a table @access public @return object
[ "classic", "method", "to", "truncate", "a", "table" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L611-L621
10,027
las93/attila
Attila/core/Model.php
Model._checkEntity
private function _checkEntity($oEntityCriteria) { $sClassName = get_called_class(); $sClassName = str_replace('Model', 'Entity', $sClassName); if (!is_object($oEntityCriteria) || !$oEntityCriteria instanceof $sClassName) { throw new \Exception('You must passed '.$sClassName.' like Entity!'); } }
php
private function _checkEntity($oEntityCriteria) { $sClassName = get_called_class(); $sClassName = str_replace('Model', 'Entity', $sClassName); if (!is_object($oEntityCriteria) || !$oEntityCriteria instanceof $sClassName) { throw new \Exception('You must passed '.$sClassName.' like Entity!'); } }
[ "private", "function", "_checkEntity", "(", "$", "oEntityCriteria", ")", "{", "$", "sClassName", "=", "get_called_class", "(", ")", ";", "$", "sClassName", "=", "str_replace", "(", "'Model'", ",", "'Entity'", ",", "$", "sClassName", ")", ";", "if", "(", "!", "is_object", "(", "$", "oEntityCriteria", ")", "||", "!", "$", "oEntityCriteria", "instanceof", "$", "sClassName", ")", "{", "throw", "new", "\\", "Exception", "(", "'You must passed '", ".", "$", "sClassName", ".", "' like Entity!'", ")", ";", "}", "}" ]
check if the entity passed is good @access private @param object $oEntityCriteria @return void
[ "check", "if", "the", "entity", "passed", "is", "good" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L643-L652
10,028
las93/attila
Attila/core/Model.php
Model._applyFilter
private function _applyFilter($oResult) { $oResult = $this->_cFilterCallback($oResult); foreach($this->_aHasOne as $sKey => $aParam) { $oResult->hasOne($aParam[0], $aParam[1], $aParam[2], $aParam[3], $aParam[4]); } foreach($this->_aHasMany as $sKey => $aParam) { $oResult->hasMany($aParam[0], $aParam[1], $aParam[2], $aParam[3], $aParam[4]); } return $this->_cFilterCallback($oResults); }
php
private function _applyFilter($oResult) { $oResult = $this->_cFilterCallback($oResult); foreach($this->_aHasOne as $sKey => $aParam) { $oResult->hasOne($aParam[0], $aParam[1], $aParam[2], $aParam[3], $aParam[4]); } foreach($this->_aHasMany as $sKey => $aParam) { $oResult->hasMany($aParam[0], $aParam[1], $aParam[2], $aParam[3], $aParam[4]); } return $this->_cFilterCallback($oResults); }
[ "private", "function", "_applyFilter", "(", "$", "oResult", ")", "{", "$", "oResult", "=", "$", "this", "->", "_cFilterCallback", "(", "$", "oResult", ")", ";", "foreach", "(", "$", "this", "->", "_aHasOne", "as", "$", "sKey", "=>", "$", "aParam", ")", "{", "$", "oResult", "->", "hasOne", "(", "$", "aParam", "[", "0", "]", ",", "$", "aParam", "[", "1", "]", ",", "$", "aParam", "[", "2", "]", ",", "$", "aParam", "[", "3", "]", ",", "$", "aParam", "[", "4", "]", ")", ";", "}", "foreach", "(", "$", "this", "->", "_aHasMany", "as", "$", "sKey", "=>", "$", "aParam", ")", "{", "$", "oResult", "->", "hasMany", "(", "$", "aParam", "[", "0", "]", ",", "$", "aParam", "[", "1", "]", ",", "$", "aParam", "[", "2", "]", ",", "$", "aParam", "[", "3", "]", ",", "$", "aParam", "[", "4", "]", ")", ";", "}", "return", "$", "this", "->", "_cFilterCallback", "(", "$", "oResults", ")", ";", "}" ]
apply the filter on the result and add the join @access private @param object $oResult result to apply filter @return object
[ "apply", "the", "filter", "on", "the", "result", "and", "add", "the", "join" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L661-L676
10,029
las93/attila
Attila/core/Model.php
Model.belongsTo
public function belongsTo($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity, array $aOptions = array()) { $this->_aHasOne[$sEntityJoinName] = array($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity); }
php
public function belongsTo($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity, array $aOptions = array()) { $this->_aHasOne[$sEntityJoinName] = array($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity); }
[ "public", "function", "belongsTo", "(", "$", "sPrimaryKeyName", ",", "$", "sEntityJoinName", ",", "$", "sForeignKeyName", ",", "$", "sNamespaceEntity", ",", "array", "$", "aOptions", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_aHasOne", "[", "$", "sEntityJoinName", "]", "=", "array", "(", "$", "sPrimaryKeyName", ",", "$", "sEntityJoinName", ",", "$", "sForeignKeyName", ",", "$", "sNamespaceEntity", ")", ";", "}" ]
create a join in many to one @access public @param string $sPrimaryKeyName @param string $sEntityJoinName @param string $sForeignKeyName @param string $sNamespaceEntity @param array $aOptions @return object
[ "create", "a", "join", "in", "many", "to", "one" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L702-L705
10,030
las93/attila
Attila/core/Model.php
Model.hasManyToMany
public function hasManyToMany($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity, $sManyToManyKeyName, $sManyToManyTableName, array $aOptions = array()) { $this->_ahasMany[$sEntityJoinName] = function($mParameters = null) use ($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sManyToManyKeyName, $sManyToManyTableName, $sNamespaceEntity) { if (!isset($this->$sEntityJoinName)) { $oOrm = new Orm; $oOrm->select(array('*')) ->from($sEntityJoinName); if ($mParameters) { $aWhere[$sForeignKeyName] = $mParameters; } else { $sMethodName = 'get_'.$sPrimaryKeyName; $aWhere[$sForeignKeyName] = $this->$sMethodName(); } $this->$sEntityJoinName = $oOrm->where($aWhere) ->load(false, $sNamespaceEntity.'\\'); } $aResults = array(); foreach ($this->$sEntityJoinName as $iKey => $oOne) { $oOrm = new Orm; $oOrm->select(array('*')) ->from($sManyToManyTableName); if ($mParameters) { $aWhere[$sManyToManyKeyName] = $mParameters; } else { $sMethodName = 'get_'.$sManyToManyKeyName; $aWhere[$sManyToManyKeyName] = $this->$sMethodName(); } $aResults[] = $oOrm->where($aWhere) ->load(false, $sNamespaceEntity.'\\'); } return $aResults; }; }
php
public function hasManyToMany($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sNamespaceEntity, $sManyToManyKeyName, $sManyToManyTableName, array $aOptions = array()) { $this->_ahasMany[$sEntityJoinName] = function($mParameters = null) use ($sPrimaryKeyName, $sEntityJoinName, $sForeignKeyName, $sManyToManyKeyName, $sManyToManyTableName, $sNamespaceEntity) { if (!isset($this->$sEntityJoinName)) { $oOrm = new Orm; $oOrm->select(array('*')) ->from($sEntityJoinName); if ($mParameters) { $aWhere[$sForeignKeyName] = $mParameters; } else { $sMethodName = 'get_'.$sPrimaryKeyName; $aWhere[$sForeignKeyName] = $this->$sMethodName(); } $this->$sEntityJoinName = $oOrm->where($aWhere) ->load(false, $sNamespaceEntity.'\\'); } $aResults = array(); foreach ($this->$sEntityJoinName as $iKey => $oOne) { $oOrm = new Orm; $oOrm->select(array('*')) ->from($sManyToManyTableName); if ($mParameters) { $aWhere[$sManyToManyKeyName] = $mParameters; } else { $sMethodName = 'get_'.$sManyToManyKeyName; $aWhere[$sManyToManyKeyName] = $this->$sMethodName(); } $aResults[] = $oOrm->where($aWhere) ->load(false, $sNamespaceEntity.'\\'); } return $aResults; }; }
[ "public", "function", "hasManyToMany", "(", "$", "sPrimaryKeyName", ",", "$", "sEntityJoinName", ",", "$", "sForeignKeyName", ",", "$", "sNamespaceEntity", ",", "$", "sManyToManyKeyName", ",", "$", "sManyToManyTableName", ",", "array", "$", "aOptions", "=", "array", "(", ")", ")", "{", "$", "this", "->", "_ahasMany", "[", "$", "sEntityJoinName", "]", "=", "function", "(", "$", "mParameters", "=", "null", ")", "use", "(", "$", "sPrimaryKeyName", ",", "$", "sEntityJoinName", ",", "$", "sForeignKeyName", ",", "$", "sManyToManyKeyName", ",", "$", "sManyToManyTableName", ",", "$", "sNamespaceEntity", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "$", "sEntityJoinName", ")", ")", "{", "$", "oOrm", "=", "new", "Orm", ";", "$", "oOrm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "sEntityJoinName", ")", ";", "if", "(", "$", "mParameters", ")", "{", "$", "aWhere", "[", "$", "sForeignKeyName", "]", "=", "$", "mParameters", ";", "}", "else", "{", "$", "sMethodName", "=", "'get_'", ".", "$", "sPrimaryKeyName", ";", "$", "aWhere", "[", "$", "sForeignKeyName", "]", "=", "$", "this", "->", "$", "sMethodName", "(", ")", ";", "}", "$", "this", "->", "$", "sEntityJoinName", "=", "$", "oOrm", "->", "where", "(", "$", "aWhere", ")", "->", "load", "(", "false", ",", "$", "sNamespaceEntity", ".", "'\\\\'", ")", ";", "}", "$", "aResults", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "$", "sEntityJoinName", "as", "$", "iKey", "=>", "$", "oOne", ")", "{", "$", "oOrm", "=", "new", "Orm", ";", "$", "oOrm", "->", "select", "(", "array", "(", "'*'", ")", ")", "->", "from", "(", "$", "sManyToManyTableName", ")", ";", "if", "(", "$", "mParameters", ")", "{", "$", "aWhere", "[", "$", "sManyToManyKeyName", "]", "=", "$", "mParameters", ";", "}", "else", "{", "$", "sMethodName", "=", "'get_'", ".", "$", "sManyToManyKeyName", ";", "$", "aWhere", "[", "$", "sManyToManyKeyName", "]", "=", "$", "this", "->", "$", "sMethodName", "(", ")", ";", "}", "$", "aResults", "[", "]", "=", "$", "oOrm", "->", "where", "(", "$", "aWhere", ")", "->", "load", "(", "false", ",", "$", "sNamespaceEntity", ".", "'\\\\'", ")", ";", "}", "return", "$", "aResults", ";", "}", ";", "}" ]
create a join in many to many @access public @param string $sPrimaryKeyName @param string $sEntityJoinName @param string $sForeignKeyName @param string $sNamespaceEntity @param unknown $sManyToManyKeyName @param unknown $sManyToManyTableName @param array $aOptions @return object
[ "create", "a", "join", "in", "many", "to", "many" ]
ad73611956ee96a95170a6340f110a948cfe5965
https://github.com/las93/attila/blob/ad73611956ee96a95170a6340f110a948cfe5965/Attila/core/Model.php#L720-L772
10,031
octris/parser
libs/Parser/Grammar.php
Grammar.addRule
public function addRule($id, array $rule, $initial = false) { if (isset($this->rules[$id])) { throw new \Exception('Rule is already defined!'); } // { validate $iterator = new \RecursiveIteratorIterator( new \RecursiveArrayIterator($rule), true ); foreach ($iterator as $k => $v) { if (!is_int($k)) { if (!is_array($v)) { throw new \Exception(sprintf("No array specified for rule operator '%s'", $k)); } switch ($k) { case '$option': if (($cnt = count($v)) != 1) { throw new \Exception(sprintf("Rule operator '\$option' takes exactly one item, '%d' given", $cnt)); } break; case '$alternation': case '$concatenation': case '$repeat': break; default: throw new \Exception(sprintf("Invalid rule operator '%s'", $k)); } } } // } $this->rules[$id] = $rule; if ($initial) { $this->initial = $id; } }
php
public function addRule($id, array $rule, $initial = false) { if (isset($this->rules[$id])) { throw new \Exception('Rule is already defined!'); } // { validate $iterator = new \RecursiveIteratorIterator( new \RecursiveArrayIterator($rule), true ); foreach ($iterator as $k => $v) { if (!is_int($k)) { if (!is_array($v)) { throw new \Exception(sprintf("No array specified for rule operator '%s'", $k)); } switch ($k) { case '$option': if (($cnt = count($v)) != 1) { throw new \Exception(sprintf("Rule operator '\$option' takes exactly one item, '%d' given", $cnt)); } break; case '$alternation': case '$concatenation': case '$repeat': break; default: throw new \Exception(sprintf("Invalid rule operator '%s'", $k)); } } } // } $this->rules[$id] = $rule; if ($initial) { $this->initial = $id; } }
[ "public", "function", "addRule", "(", "$", "id", ",", "array", "$", "rule", ",", "$", "initial", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "rules", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'Rule is already defined!'", ")", ";", "}", "// { validate", "$", "iterator", "=", "new", "\\", "RecursiveIteratorIterator", "(", "new", "\\", "RecursiveArrayIterator", "(", "$", "rule", ")", ",", "true", ")", ";", "foreach", "(", "$", "iterator", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "!", "is_int", "(", "$", "k", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "v", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "\"No array specified for rule operator '%s'\"", ",", "$", "k", ")", ")", ";", "}", "switch", "(", "$", "k", ")", "{", "case", "'$option'", ":", "if", "(", "(", "$", "cnt", "=", "count", "(", "$", "v", ")", ")", "!=", "1", ")", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "\"Rule operator '\\$option' takes exactly one item, '%d' given\"", ",", "$", "cnt", ")", ")", ";", "}", "break", ";", "case", "'$alternation'", ":", "case", "'$concatenation'", ":", "case", "'$repeat'", ":", "break", ";", "default", ":", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "\"Invalid rule operator '%s'\"", ",", "$", "k", ")", ")", ";", "}", "}", "}", "// }", "$", "this", "->", "rules", "[", "$", "id", "]", "=", "$", "rule", ";", "if", "(", "$", "initial", ")", "{", "$", "this", "->", "initial", "=", "$", "id", ";", "}", "}" ]
Add a rule to the grammar. @param int|string $id Token identifier to apply the rule for. @param array $rule Grammar rule. @param bool $initial Whether to set the rule as initial.
[ "Add", "a", "rule", "to", "the", "grammar", "." ]
17d155586fdfbb4f6fd973c48d8758114084e000
https://github.com/octris/parser/blob/17d155586fdfbb4f6fd973c48d8758114084e000/libs/Parser/Grammar.php#L71-L111
10,032
octris/parser
libs/Parser/Grammar.php
Grammar.addEvent
public function addEvent($id, callable $cb) { if (!isset($this->events[$id])) { $this->events[$id] = []; } $this->events[$id][] = $cb; }
php
public function addEvent($id, callable $cb) { if (!isset($this->events[$id])) { $this->events[$id] = []; } $this->events[$id][] = $cb; }
[ "public", "function", "addEvent", "(", "$", "id", ",", "callable", "$", "cb", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "events", "[", "$", "id", "]", ")", ")", "{", "$", "this", "->", "events", "[", "$", "id", "]", "=", "[", "]", ";", "}", "$", "this", "->", "events", "[", "$", "id", "]", "[", "]", "=", "$", "cb", ";", "}" ]
Add an event for a token. @param int $id Token identifier. @param callable $cb Callback to call if the token occurs.
[ "Add", "an", "event", "for", "a", "token", "." ]
17d155586fdfbb4f6fd973c48d8758114084e000
https://github.com/octris/parser/blob/17d155586fdfbb4f6fd973c48d8758114084e000/libs/Parser/Grammar.php#L119-L126
10,033
octris/parser
libs/Parser/Grammar.php
Grammar.getEBNF
public function getEBNF() { $glue = array( '$concatenation' => array('', ' , ', ''), '$alternation' => array('( ', ' | ', ' )'), '$repeat' => array('{ ', '', ' }'), '$option' => array('[ ', '', ' ]') ); $render = function ($rule) use ($glue, &$render) { if (is_array($rule)) { $type = key($rule); foreach ($rule[$type] as &$_rule) { $_rule = $render($_rule); } $return = $glue[$type][0] . implode($glue[$type][1], $rule[$type]) . $glue[$type][2]; } else { $return = $rule; } return $return; }; $return = ''; foreach ($this->rules as $name => $rule) { $return .= $name . ' = ' . $render($rule) . " ;\n"; } return $return; }
php
public function getEBNF() { $glue = array( '$concatenation' => array('', ' , ', ''), '$alternation' => array('( ', ' | ', ' )'), '$repeat' => array('{ ', '', ' }'), '$option' => array('[ ', '', ' ]') ); $render = function ($rule) use ($glue, &$render) { if (is_array($rule)) { $type = key($rule); foreach ($rule[$type] as &$_rule) { $_rule = $render($_rule); } $return = $glue[$type][0] . implode($glue[$type][1], $rule[$type]) . $glue[$type][2]; } else { $return = $rule; } return $return; }; $return = ''; foreach ($this->rules as $name => $rule) { $return .= $name . ' = ' . $render($rule) . " ;\n"; } return $return; }
[ "public", "function", "getEBNF", "(", ")", "{", "$", "glue", "=", "array", "(", "'$concatenation'", "=>", "array", "(", "''", ",", "' , '", ",", "''", ")", ",", "'$alternation'", "=>", "array", "(", "'( '", ",", "' | '", ",", "' )'", ")", ",", "'$repeat'", "=>", "array", "(", "'{ '", ",", "''", ",", "' }'", ")", ",", "'$option'", "=>", "array", "(", "'[ '", ",", "''", ",", "' ]'", ")", ")", ";", "$", "render", "=", "function", "(", "$", "rule", ")", "use", "(", "$", "glue", ",", "&", "$", "render", ")", "{", "if", "(", "is_array", "(", "$", "rule", ")", ")", "{", "$", "type", "=", "key", "(", "$", "rule", ")", ";", "foreach", "(", "$", "rule", "[", "$", "type", "]", "as", "&", "$", "_rule", ")", "{", "$", "_rule", "=", "$", "render", "(", "$", "_rule", ")", ";", "}", "$", "return", "=", "$", "glue", "[", "$", "type", "]", "[", "0", "]", ".", "implode", "(", "$", "glue", "[", "$", "type", "]", "[", "1", "]", ",", "$", "rule", "[", "$", "type", "]", ")", ".", "$", "glue", "[", "$", "type", "]", "[", "2", "]", ";", "}", "else", "{", "$", "return", "=", "$", "rule", ";", "}", "return", "$", "return", ";", "}", ";", "$", "return", "=", "''", ";", "foreach", "(", "$", "this", "->", "rules", "as", "$", "name", "=>", "$", "rule", ")", "{", "$", "return", ".=", "$", "name", ".", "' = '", ".", "$", "render", "(", "$", "rule", ")", ".", "\" ;\\n\"", ";", "}", "return", "$", "return", ";", "}" ]
Return the EBNF for the defined grammar. @return string The EBNF.
[ "Return", "the", "EBNF", "for", "the", "defined", "grammar", "." ]
17d155586fdfbb4f6fd973c48d8758114084e000
https://github.com/octris/parser/blob/17d155586fdfbb4f6fd973c48d8758114084e000/libs/Parser/Grammar.php#L164-L198
10,034
watoki/cfg
src/watoki/cfg/cli/CreateUserConfigurationCommand.php
CreateUserConfigurationCommand.doExecute
public function doExecute(Console $console) { if (file_exists($this->targetFile)) { $console->out->writeLine('Already exists'); return; } $creator = new Creator(); $creator->createStub($this->baseClass, $this->targetFile); $console->out->writeLine('Created user configuration in ' . $this->targetFile); }
php
public function doExecute(Console $console) { if (file_exists($this->targetFile)) { $console->out->writeLine('Already exists'); return; } $creator = new Creator(); $creator->createStub($this->baseClass, $this->targetFile); $console->out->writeLine('Created user configuration in ' . $this->targetFile); }
[ "public", "function", "doExecute", "(", "Console", "$", "console", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "targetFile", ")", ")", "{", "$", "console", "->", "out", "->", "writeLine", "(", "'Already exists'", ")", ";", "return", ";", "}", "$", "creator", "=", "new", "Creator", "(", ")", ";", "$", "creator", "->", "createStub", "(", "$", "this", "->", "baseClass", ",", "$", "this", "->", "targetFile", ")", ";", "$", "console", "->", "out", "->", "writeLine", "(", "'Created user configuration in '", ".", "$", "this", "->", "targetFile", ")", ";", "}" ]
Creates a user configuration class to overwrite a default configuration
[ "Creates", "a", "user", "configuration", "class", "to", "overwrite", "a", "default", "configuration" ]
06daffb046ff0a0de02fc29196efc3b414a31ed7
https://github.com/watoki/cfg/blob/06daffb046ff0a0de02fc29196efc3b414a31ed7/src/watoki/cfg/cli/CreateUserConfigurationCommand.php#L32-L41
10,035
sebastianmonzel/webfiles-framework-php
source/core/datasystem/database/MDatabaseConnection.php
MDatabaseConnection.getInstance
static public function getInstance($instanceName) { if (!isset(self::$instanceArray[$instanceName])) { self::$instanceArray[$instanceName] = new MDatabaseConnection(); } return self::$instanceArray[$instanceName]; }
php
static public function getInstance($instanceName) { if (!isset(self::$instanceArray[$instanceName])) { self::$instanceArray[$instanceName] = new MDatabaseConnection(); } return self::$instanceArray[$instanceName]; }
[ "static", "public", "function", "getInstance", "(", "$", "instanceName", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "instanceArray", "[", "$", "instanceName", "]", ")", ")", "{", "self", "::", "$", "instanceArray", "[", "$", "instanceName", "]", "=", "new", "MDatabaseConnection", "(", ")", ";", "}", "return", "self", "::", "$", "instanceArray", "[", "$", "instanceName", "]", ";", "}" ]
multiton to administrate the instances of the connection and global accessing @param String $instanceName @return object
[ "multiton", "to", "administrate", "the", "instances", "of", "the", "connection", "and", "global", "accessing" ]
5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d
https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datasystem/database/MDatabaseConnection.php#L72-L78
10,036
sebastianmonzel/webfiles-framework-php
source/core/datasystem/database/MDatabaseConnection.php
MDatabaseConnection.connect
public function connect() { $this->connection = @new \mysqli( $this->host, $this->username, $this->password, $this->databaseName ); if (!$this->connection->connect_errno) { $this->connection->autocommit(1); return true; } else { return false; } }
php
public function connect() { $this->connection = @new \mysqli( $this->host, $this->username, $this->password, $this->databaseName ); if (!$this->connection->connect_errno) { $this->connection->autocommit(1); return true; } else { return false; } }
[ "public", "function", "connect", "(", ")", "{", "$", "this", "->", "connection", "=", "@", "new", "\\", "mysqli", "(", "$", "this", "->", "host", ",", "$", "this", "->", "username", ",", "$", "this", "->", "password", ",", "$", "this", "->", "databaseName", ")", ";", "if", "(", "!", "$", "this", "->", "connection", "->", "connect_errno", ")", "{", "$", "this", "->", "connection", "->", "autocommit", "(", "1", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
connects to the database server
[ "connects", "to", "the", "database", "server" ]
5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d
https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datasystem/database/MDatabaseConnection.php#L83-L98
10,037
sebastianmonzel/webfiles-framework-php
source/core/datasystem/database/MDatabaseConnection.php
MDatabaseConnection.query
public function query($sqlCommand) { $result = $this->connection->query($sqlCommand); if ($this->getError() != null ) { throw new MWebfilesFrameworkException("Error orrured on executing sql: " . $this->getError() .", SQL: " . $sqlCommand); } return $result; }
php
public function query($sqlCommand) { $result = $this->connection->query($sqlCommand); if ($this->getError() != null ) { throw new MWebfilesFrameworkException("Error orrured on executing sql: " . $this->getError() .", SQL: " . $sqlCommand); } return $result; }
[ "public", "function", "query", "(", "$", "sqlCommand", ")", "{", "$", "result", "=", "$", "this", "->", "connection", "->", "query", "(", "$", "sqlCommand", ")", ";", "if", "(", "$", "this", "->", "getError", "(", ")", "!=", "null", ")", "{", "throw", "new", "MWebfilesFrameworkException", "(", "\"Error orrured on executing sql: \"", ".", "$", "this", "->", "getError", "(", ")", ".", "\", SQL: \"", ".", "$", "sqlCommand", ")", ";", "}", "return", "$", "result", ";", "}" ]
queries the database with the specified sql command @param $sqlCommand @return bool|\mysqli_result @internal param String $p_sSqlCommand
[ "queries", "the", "database", "with", "the", "specified", "sql", "command" ]
5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d
https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datasystem/database/MDatabaseConnection.php#L115-L123
10,038
bishopb/vanilla
applications/skeleton/controllers/class.skeletoncontroller.php
SkeletonController.Initialize
public function Initialize() { // There are 4 delivery types used by Render(). // DELIVERY_TYPE_ALL is the default and indicates an entire page view. if ($this->DeliveryType() == DELIVERY_TYPE_ALL) $this->Head = new HeadModule($this); // Call Gdn_Controller's Initialize() as well. parent::Initialize(); }
php
public function Initialize() { // There are 4 delivery types used by Render(). // DELIVERY_TYPE_ALL is the default and indicates an entire page view. if ($this->DeliveryType() == DELIVERY_TYPE_ALL) $this->Head = new HeadModule($this); // Call Gdn_Controller's Initialize() as well. parent::Initialize(); }
[ "public", "function", "Initialize", "(", ")", "{", "// There are 4 delivery types used by Render().", "// DELIVERY_TYPE_ALL is the default and indicates an entire page view.", "if", "(", "$", "this", "->", "DeliveryType", "(", ")", "==", "DELIVERY_TYPE_ALL", ")", "$", "this", "->", "Head", "=", "new", "HeadModule", "(", "$", "this", ")", ";", "// Call Gdn_Controller's Initialize() as well.", "parent", "::", "Initialize", "(", ")", ";", "}" ]
This is a good place to include JS, CSS, and modules used by all methods of this controller. Always called by dispatcher before controller's requested method. @since 1.0 @access public
[ "This", "is", "a", "good", "place", "to", "include", "JS", "CSS", "and", "modules", "used", "by", "all", "methods", "of", "this", "controller", "." ]
8494eb4a4ad61603479015a8054d23ff488364e8
https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/skeleton/controllers/class.skeletoncontroller.php#L41-L49
10,039
tonjoo/tiga-framework
src/MessageBag.php
MessageBag.offsetGet
public function offsetGet($offset) { if (!isset($this->container[$offset])) { $this->container[$offset] = new self(); } return $this->container[$offset]; }
php
public function offsetGet($offset) { if (!isset($this->container[$offset])) { $this->container[$offset] = new self(); } return $this->container[$offset]; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "container", "[", "$", "offset", "]", ")", ")", "{", "$", "this", "->", "container", "[", "$", "offset", "]", "=", "new", "self", "(", ")", ";", "}", "return", "$", "this", "->", "container", "[", "$", "offset", "]", ";", "}" ]
Get value from array. @param string|int $offset @return mixed
[ "Get", "value", "from", "array", "." ]
3c2eebd3bc616106fa1bba3e43f1791aff75eec5
https://github.com/tonjoo/tiga-framework/blob/3c2eebd3bc616106fa1bba3e43f1791aff75eec5/src/MessageBag.php#L61-L68
10,040
agentmedia/phine-forms
src/Forms/Modules/Backend/SelectForm.php
SelectForm.InitForm
protected function InitForm() { $this->select = $this->LoadElement(); $this->AddNameField(); $this->AddValueField(); $this->AddLabelField(); $this->AddOptionsField(); $this->AddDisableFrontendValidationField(); $this->AddRequiredField(); $this->AddTemplateField(); $this->AddCssClassField(); $this->AddCssIDField(); $this->AddSubmit(); }
php
protected function InitForm() { $this->select = $this->LoadElement(); $this->AddNameField(); $this->AddValueField(); $this->AddLabelField(); $this->AddOptionsField(); $this->AddDisableFrontendValidationField(); $this->AddRequiredField(); $this->AddTemplateField(); $this->AddCssClassField(); $this->AddCssIDField(); $this->AddSubmit(); }
[ "protected", "function", "InitForm", "(", ")", "{", "$", "this", "->", "select", "=", "$", "this", "->", "LoadElement", "(", ")", ";", "$", "this", "->", "AddNameField", "(", ")", ";", "$", "this", "->", "AddValueField", "(", ")", ";", "$", "this", "->", "AddLabelField", "(", ")", ";", "$", "this", "->", "AddOptionsField", "(", ")", ";", "$", "this", "->", "AddDisableFrontendValidationField", "(", ")", ";", "$", "this", "->", "AddRequiredField", "(", ")", ";", "$", "this", "->", "AddTemplateField", "(", ")", ";", "$", "this", "->", "AddCssClassField", "(", ")", ";", "$", "this", "->", "AddCssIDField", "(", ")", ";", "$", "this", "->", "AddSubmit", "(", ")", ";", "}" ]
Initializes the form by adding all necessary elements
[ "Initializes", "the", "form", "by", "adding", "all", "necessary", "elements" ]
cd7a92ea443756bef5885a9e8f59ad6b8d2771fc
https://github.com/agentmedia/phine-forms/blob/cd7a92ea443756bef5885a9e8f59ad6b8d2771fc/src/Forms/Modules/Backend/SelectForm.php#L48-L63
10,041
agentmedia/phine-forms
src/Forms/Modules/Backend/SelectForm.php
SelectForm.SaveElement
protected function SaveElement() { $this->select->SetLabel($this->Value('Label')); $this->select->SetName($this->Value('Name')); $this->select->SetValue($this->Value('Value')); $this->select->SetDisableFrontendValidation((bool)$this->Value('DisableFrontendValidation')); $this->select->SetRequired((bool)$this->Value('Required')); return $this->select; }
php
protected function SaveElement() { $this->select->SetLabel($this->Value('Label')); $this->select->SetName($this->Value('Name')); $this->select->SetValue($this->Value('Value')); $this->select->SetDisableFrontendValidation((bool)$this->Value('DisableFrontendValidation')); $this->select->SetRequired((bool)$this->Value('Required')); return $this->select; }
[ "protected", "function", "SaveElement", "(", ")", "{", "$", "this", "->", "select", "->", "SetLabel", "(", "$", "this", "->", "Value", "(", "'Label'", ")", ")", ";", "$", "this", "->", "select", "->", "SetName", "(", "$", "this", "->", "Value", "(", "'Name'", ")", ")", ";", "$", "this", "->", "select", "->", "SetValue", "(", "$", "this", "->", "Value", "(", "'Value'", ")", ")", ";", "$", "this", "->", "select", "->", "SetDisableFrontendValidation", "(", "(", "bool", ")", "$", "this", "->", "Value", "(", "'DisableFrontendValidation'", ")", ")", ";", "$", "this", "->", "select", "->", "SetRequired", "(", "(", "bool", ")", "$", "this", "->", "Value", "(", "'Required'", ")", ")", ";", "return", "$", "this", "->", "select", ";", "}" ]
Stores the select content's base properties @return ContentSelect Returns the select content element
[ "Stores", "the", "select", "content", "s", "base", "properties" ]
cd7a92ea443756bef5885a9e8f59ad6b8d2771fc
https://github.com/agentmedia/phine-forms/blob/cd7a92ea443756bef5885a9e8f59ad6b8d2771fc/src/Forms/Modules/Backend/SelectForm.php#L149-L157
10,042
arnold-almeida/UIKit
src/Almeida/UIKit/Elements/Link/Generators/BootstrapLink.php
Bootstrap.hyperlink
public function hyperlink($label, $url, $options=array()) { $defaults = array( 'class' => 'btn btn-info' ); $options = array_merge($defaults, $options); return parent::hyperlink($label, $url, $options); }
php
public function hyperlink($label, $url, $options=array()) { $defaults = array( 'class' => 'btn btn-info' ); $options = array_merge($defaults, $options); return parent::hyperlink($label, $url, $options); }
[ "public", "function", "hyperlink", "(", "$", "label", ",", "$", "url", ",", "$", "options", "=", "array", "(", ")", ")", "{", "$", "defaults", "=", "array", "(", "'class'", "=>", "'btn btn-info'", ")", ";", "$", "options", "=", "array_merge", "(", "$", "defaults", ",", "$", "options", ")", ";", "return", "parent", "::", "hyperlink", "(", "$", "label", ",", "$", "url", ",", "$", "options", ")", ";", "}" ]
Returns a Bootstrap flavoured hypelink
[ "Returns", "a", "Bootstrap", "flavoured", "hypelink" ]
cc52f46df011ec2f3676245c90c376da20c40e41
https://github.com/arnold-almeida/UIKit/blob/cc52f46df011ec2f3676245c90c376da20c40e41/src/Almeida/UIKit/Elements/Link/Generators/BootstrapLink.php#L20-L27
10,043
bytic/view
src/ViewFinder/ViewFinder.php
ViewFinder.findRelativePathView
protected function findRelativePathView($name) { $caller = Backtrace::getViewOrigin(); return $this->findInPaths($name, [dirname($caller)]); }
php
protected function findRelativePathView($name) { $caller = Backtrace::getViewOrigin(); return $this->findInPaths($name, [dirname($caller)]); }
[ "protected", "function", "findRelativePathView", "(", "$", "name", ")", "{", "$", "caller", "=", "Backtrace", "::", "getViewOrigin", "(", ")", ";", "return", "$", "this", "->", "findInPaths", "(", "$", "name", ",", "[", "dirname", "(", "$", "caller", ")", "]", ")", ";", "}" ]
Get the path to a template with a relative path. @param string $name @return string
[ "Get", "the", "path", "to", "a", "template", "with", "a", "relative", "path", "." ]
afdc509edc626b9aed0ffa4514199fb16759453c
https://github.com/bytic/view/blob/afdc509edc626b9aed0ffa4514199fb16759453c/src/ViewFinder/ViewFinder.php#L50-L54
10,044
emaphp/eMapper
lib/eMapper/Fluent/Query/AbstractQuery.php
AbstractQuery.innerJoin
public function innerJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::INNER_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::INNER_JOIN, $table, $alias_or_cond, $cond); return $this; }
php
public function innerJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::INNER_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::INNER_JOIN, $table, $alias_or_cond, $cond); return $this; }
[ "public", "function", "innerJoin", "(", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "cond", ")", ")", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "INNER_JOIN", ",", "$", "table", ",", "null", ",", "$", "alias_or_cond", ")", ";", "else", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "INNER_JOIN", ",", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", ")", ";", "return", "$", "this", ";", "}" ]
Appends an inner join to join list @param string $table @param string | \eMapper\SQL\Predicate\SQLPredicate $alias_or_cond @param string | \eMapper\SQL\Predicate\SQLPredicate $cond @return \eMapper\Fluent\Query\AbstractQuery
[ "Appends", "an", "inner", "join", "to", "join", "list" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/AbstractQuery.php#L118-L124
10,045
emaphp/eMapper
lib/eMapper/Fluent/Query/AbstractQuery.php
AbstractQuery.leftJoin
public function leftJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::LEFT_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::LEFT_JOIN, $table, $alias_or_cond, $cond); return $this; }
php
public function leftJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::LEFT_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::LEFT_JOIN, $table, $alias_or_cond, $cond); return $this; }
[ "public", "function", "leftJoin", "(", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "cond", ")", ")", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "LEFT_JOIN", ",", "$", "table", ",", "null", ",", "$", "alias_or_cond", ")", ";", "else", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "LEFT_JOIN", ",", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", ")", ";", "return", "$", "this", ";", "}" ]
Appends a left join to join list @param string $table @param string | \eMapper\SQL\Predicate\SQLPredicate $alias_or_cond @param string | \eMapper\SQL\Predicate\SQLPredicate $cond @return \eMapper\Fluent\Query\AbstractQuery
[ "Appends", "a", "left", "join", "to", "join", "list" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/AbstractQuery.php#L133-L139
10,046
emaphp/eMapper
lib/eMapper/Fluent/Query/AbstractQuery.php
AbstractQuery.fullOuterJoin
public function fullOuterJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::FULL_OUTER_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::FULL_OUTER_JOIN, $table, $alias_or_cond, $cond); return $this; }
php
public function fullOuterJoin($table, $alias_or_cond, $cond = null) { if (is_null($cond)) $this->joins[] = new JoinClause(JoinClause::FULL_OUTER_JOIN, $table, null, $alias_or_cond); else $this->joins[] = new JoinClause(JoinClause::FULL_OUTER_JOIN, $table, $alias_or_cond, $cond); return $this; }
[ "public", "function", "fullOuterJoin", "(", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "cond", ")", ")", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "FULL_OUTER_JOIN", ",", "$", "table", ",", "null", ",", "$", "alias_or_cond", ")", ";", "else", "$", "this", "->", "joins", "[", "]", "=", "new", "JoinClause", "(", "JoinClause", "::", "FULL_OUTER_JOIN", ",", "$", "table", ",", "$", "alias_or_cond", ",", "$", "cond", ")", ";", "return", "$", "this", ";", "}" ]
Appends a full outer join to join list @param string $table @param string | \eMapper\SQL\Predicate\SQLPredicate $alias_or_cond @param string | \eMapper\SQL\Predicate\SQLPredicate $cond @return \eMapper\Fluent\Query\AbstractQuery
[ "Appends", "a", "full", "outer", "join", "to", "join", "list" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/AbstractQuery.php#L148-L154
10,047
emaphp/eMapper
lib/eMapper/Fluent/Query/AbstractQuery.php
AbstractQuery.updateSchema
protected function updateSchema(Schema $schema) { foreach($schema->getJoins() as $join) { $assoc = $join->getAssociation(); $parent = $join->getParent(); if (is_null($parent)) $assoc->appendJoin($this, $this->alias, $join->getAlias(), true); else { $alias = $schema->getJoin($parent)->getAlias(); $assoc->appendJoin($this, $alias, $join->getAlias(), true); } } }
php
protected function updateSchema(Schema $schema) { foreach($schema->getJoins() as $join) { $assoc = $join->getAssociation(); $parent = $join->getParent(); if (is_null($parent)) $assoc->appendJoin($this, $this->alias, $join->getAlias(), true); else { $alias = $schema->getJoin($parent)->getAlias(); $assoc->appendJoin($this, $alias, $join->getAlias(), true); } } }
[ "protected", "function", "updateSchema", "(", "Schema", "$", "schema", ")", "{", "foreach", "(", "$", "schema", "->", "getJoins", "(", ")", "as", "$", "join", ")", "{", "$", "assoc", "=", "$", "join", "->", "getAssociation", "(", ")", ";", "$", "parent", "=", "$", "join", "->", "getParent", "(", ")", ";", "if", "(", "is_null", "(", "$", "parent", ")", ")", "$", "assoc", "->", "appendJoin", "(", "$", "this", ",", "$", "this", "->", "alias", ",", "$", "join", "->", "getAlias", "(", ")", ",", "true", ")", ";", "else", "{", "$", "alias", "=", "$", "schema", "->", "getJoin", "(", "$", "parent", ")", "->", "getAlias", "(", ")", ";", "$", "assoc", "->", "appendJoin", "(", "$", "this", ",", "$", "alias", ",", "$", "join", "->", "getAlias", "(", ")", ",", "true", ")", ";", "}", "}", "}" ]
Updates query schema @param \eMapper\Query\Schema $schema
[ "Updates", "query", "schema" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/AbstractQuery.php#L160-L171
10,048
emaphp/eMapper
lib/eMapper/Fluent/Query/AbstractQuery.php
AbstractQuery.exec
public function exec() { list($query, $args) = $this->build(); if (empty($this->config)) return call_user_func([$this->fluent->getMapper(), 'sql'], $query, $args); return call_user_func([$this->fluent->getMapper()->merge($this->config), 'sql'], $query, $args); }
php
public function exec() { list($query, $args) = $this->build(); if (empty($this->config)) return call_user_func([$this->fluent->getMapper(), 'sql'], $query, $args); return call_user_func([$this->fluent->getMapper()->merge($this->config), 'sql'], $query, $args); }
[ "public", "function", "exec", "(", ")", "{", "list", "(", "$", "query", ",", "$", "args", ")", "=", "$", "this", "->", "build", "(", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "config", ")", ")", "return", "call_user_func", "(", "[", "$", "this", "->", "fluent", "->", "getMapper", "(", ")", ",", "'sql'", "]", ",", "$", "query", ",", "$", "args", ")", ";", "return", "call_user_func", "(", "[", "$", "this", "->", "fluent", "->", "getMapper", "(", ")", "->", "merge", "(", "$", "this", "->", "config", ")", ",", "'sql'", "]", ",", "$", "query", ",", "$", "args", ")", ";", "}" ]
Executes the resulting query against current database @return mixed
[ "Executes", "the", "resulting", "query", "against", "current", "database" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/AbstractQuery.php#L181-L186
10,049
samurai-fw/samurai
src/Samurai/Component/Task/Processor.php
Processor.get
public function get($name) { $names = explode(self::SEPARATOR, $name); $method = array_pop($names); if ($names) { $class_name = 'Task\\' . join('\\', array_map('ucfirst', $names)) . 'TaskList'; } else { $class_name = 'Task\\TaskList'; } $class_path = $this->loader->getPathByClass($class_name, false); if ($class_path === null || ! $class_path->isExists()) throw new NotFoundException("No such task. -> {$name}"); require_once $class_path; $class_name = $class_path->getClassName(); $taskList = new $class_name(); $taskList->setOutput($this->output); $taskList->setContainer($this->raikiri()); if (! $taskList->has($method)) throw new NotImplementsException("No such task. -> {$name}"); return $taskList->get($method); }
php
public function get($name) { $names = explode(self::SEPARATOR, $name); $method = array_pop($names); if ($names) { $class_name = 'Task\\' . join('\\', array_map('ucfirst', $names)) . 'TaskList'; } else { $class_name = 'Task\\TaskList'; } $class_path = $this->loader->getPathByClass($class_name, false); if ($class_path === null || ! $class_path->isExists()) throw new NotFoundException("No such task. -> {$name}"); require_once $class_path; $class_name = $class_path->getClassName(); $taskList = new $class_name(); $taskList->setOutput($this->output); $taskList->setContainer($this->raikiri()); if (! $taskList->has($method)) throw new NotImplementsException("No such task. -> {$name}"); return $taskList->get($method); }
[ "public", "function", "get", "(", "$", "name", ")", "{", "$", "names", "=", "explode", "(", "self", "::", "SEPARATOR", ",", "$", "name", ")", ";", "$", "method", "=", "array_pop", "(", "$", "names", ")", ";", "if", "(", "$", "names", ")", "{", "$", "class_name", "=", "'Task\\\\'", ".", "join", "(", "'\\\\'", ",", "array_map", "(", "'ucfirst'", ",", "$", "names", ")", ")", ".", "'TaskList'", ";", "}", "else", "{", "$", "class_name", "=", "'Task\\\\TaskList'", ";", "}", "$", "class_path", "=", "$", "this", "->", "loader", "->", "getPathByClass", "(", "$", "class_name", ",", "false", ")", ";", "if", "(", "$", "class_path", "===", "null", "||", "!", "$", "class_path", "->", "isExists", "(", ")", ")", "throw", "new", "NotFoundException", "(", "\"No such task. -> {$name}\"", ")", ";", "require_once", "$", "class_path", ";", "$", "class_name", "=", "$", "class_path", "->", "getClassName", "(", ")", ";", "$", "taskList", "=", "new", "$", "class_name", "(", ")", ";", "$", "taskList", "->", "setOutput", "(", "$", "this", "->", "output", ")", ";", "$", "taskList", "->", "setContainer", "(", "$", "this", "->", "raikiri", "(", ")", ")", ";", "if", "(", "!", "$", "taskList", "->", "has", "(", "$", "method", ")", ")", "throw", "new", "NotImplementsException", "(", "\"No such task. -> {$name}\"", ")", ";", "return", "$", "taskList", "->", "get", "(", "$", "method", ")", ";", "}" ]
get task. format: namespace:some:do @access public @param string $name @return Task
[ "get", "task", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Task/Processor.php#L81-L101
10,050
samurai-fw/samurai
src/Samurai/Component/Task/Processor.php
Processor.find
public function find($name = null) { $tasks = []; foreach ($this->application->getAppPaths() as $path) { $files = $this->finder->path($path['dir'] . DS . 'Task')->recursive()->name('*TaskList.php')->find(); foreach ($files as $file) { $task_path = substr($file, strlen($path['dir'] . DS . 'Task' . DS), - strlen('TaskList.php')); $task_name = join(':', array_map('lcfirst', explode(DS, $task_path))); $class_name = $file->getClassName(); if (! class_exists($class_name)) continue; $refletion = new ReflectionClass($class_name); if (! $refletion->isInstantiable()) continue; $taskList = $refletion->newInstance(); $taskList->setName($task_name); foreach ($taskList->getTasks() as $task) { $tasks[] = $task; } } } if ($name) { $tasks = array_filter($tasks, function($task) use ($name) { return strpos($task->getName(), $name) === 0; }); } return $tasks; }
php
public function find($name = null) { $tasks = []; foreach ($this->application->getAppPaths() as $path) { $files = $this->finder->path($path['dir'] . DS . 'Task')->recursive()->name('*TaskList.php')->find(); foreach ($files as $file) { $task_path = substr($file, strlen($path['dir'] . DS . 'Task' . DS), - strlen('TaskList.php')); $task_name = join(':', array_map('lcfirst', explode(DS, $task_path))); $class_name = $file->getClassName(); if (! class_exists($class_name)) continue; $refletion = new ReflectionClass($class_name); if (! $refletion->isInstantiable()) continue; $taskList = $refletion->newInstance(); $taskList->setName($task_name); foreach ($taskList->getTasks() as $task) { $tasks[] = $task; } } } if ($name) { $tasks = array_filter($tasks, function($task) use ($name) { return strpos($task->getName(), $name) === 0; }); } return $tasks; }
[ "public", "function", "find", "(", "$", "name", "=", "null", ")", "{", "$", "tasks", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "application", "->", "getAppPaths", "(", ")", "as", "$", "path", ")", "{", "$", "files", "=", "$", "this", "->", "finder", "->", "path", "(", "$", "path", "[", "'dir'", "]", ".", "DS", ".", "'Task'", ")", "->", "recursive", "(", ")", "->", "name", "(", "'*TaskList.php'", ")", "->", "find", "(", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "$", "task_path", "=", "substr", "(", "$", "file", ",", "strlen", "(", "$", "path", "[", "'dir'", "]", ".", "DS", ".", "'Task'", ".", "DS", ")", ",", "-", "strlen", "(", "'TaskList.php'", ")", ")", ";", "$", "task_name", "=", "join", "(", "':'", ",", "array_map", "(", "'lcfirst'", ",", "explode", "(", "DS", ",", "$", "task_path", ")", ")", ")", ";", "$", "class_name", "=", "$", "file", "->", "getClassName", "(", ")", ";", "if", "(", "!", "class_exists", "(", "$", "class_name", ")", ")", "continue", ";", "$", "refletion", "=", "new", "ReflectionClass", "(", "$", "class_name", ")", ";", "if", "(", "!", "$", "refletion", "->", "isInstantiable", "(", ")", ")", "continue", ";", "$", "taskList", "=", "$", "refletion", "->", "newInstance", "(", ")", ";", "$", "taskList", "->", "setName", "(", "$", "task_name", ")", ";", "foreach", "(", "$", "taskList", "->", "getTasks", "(", ")", "as", "$", "task", ")", "{", "$", "tasks", "[", "]", "=", "$", "task", ";", "}", "}", "}", "if", "(", "$", "name", ")", "{", "$", "tasks", "=", "array_filter", "(", "$", "tasks", ",", "function", "(", "$", "task", ")", "use", "(", "$", "name", ")", "{", "return", "strpos", "(", "$", "task", "->", "getName", "(", ")", ",", "$", "name", ")", "===", "0", ";", "}", ")", ";", "}", "return", "$", "tasks", ";", "}" ]
find task. @param string $name
[ "find", "task", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Task/Processor.php#L109-L141
10,051
samurai-fw/samurai
src/Samurai/Component/Task/Processor.php
Processor.execute
public function execute($name, $option = []) { if (is_string($name)) { $names = explode(self::SEPARATOR, $name); $method = array_pop($names); $task = $this->get($name); } $task->execute($option); }
php
public function execute($name, $option = []) { if (is_string($name)) { $names = explode(self::SEPARATOR, $name); $method = array_pop($names); $task = $this->get($name); } $task->execute($option); }
[ "public", "function", "execute", "(", "$", "name", ",", "$", "option", "=", "[", "]", ")", "{", "if", "(", "is_string", "(", "$", "name", ")", ")", "{", "$", "names", "=", "explode", "(", "self", "::", "SEPARATOR", ",", "$", "name", ")", ";", "$", "method", "=", "array_pop", "(", "$", "names", ")", ";", "$", "task", "=", "$", "this", "->", "get", "(", "$", "name", ")", ";", "}", "$", "task", "->", "execute", "(", "$", "option", ")", ";", "}" ]
call task. @access public @param mixed $name @param array|Samurai\Samurai\Component\Task\Option $option
[ "call", "task", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Task/Processor.php#L151-L160
10,052
tadcka/Mapper
src/Tadcka/Mapper/Source/Source.php
Source.supportData
private function supportData() { $dataClass = $this->type->getDataClass(); return $this->data instanceof $dataClass || $dataClass === get_class($this->data); }
php
private function supportData() { $dataClass = $this->type->getDataClass(); return $this->data instanceof $dataClass || $dataClass === get_class($this->data); }
[ "private", "function", "supportData", "(", ")", "{", "$", "dataClass", "=", "$", "this", "->", "type", "->", "getDataClass", "(", ")", ";", "return", "$", "this", "->", "data", "instanceof", "$", "dataClass", "||", "$", "dataClass", "===", "get_class", "(", "$", "this", "->", "data", ")", ";", "}" ]
Check if mapper type support data. @return bool
[ "Check", "if", "mapper", "type", "support", "data", "." ]
6853a2be08dcd35a1013c0a4aba9b71a727ff7da
https://github.com/tadcka/Mapper/blob/6853a2be08dcd35a1013c0a4aba9b71a727ff7da/src/Tadcka/Mapper/Source/Source.php#L145-L150
10,053
the-kbA-team/typecast
src/TypeCastObject.php
TypeCastObject.cast
public function cast($object) { if (!is_object($object)) { throw new \InvalidArgumentException(sprintf('Expected an object, but got %s!', gettype($object))); } foreach ($this->map as $name => $type) { if (isset($object->{$name})) { try { $object->{$name} = $type->cast($object->{$name}); } catch (\InvalidArgumentException $iaex) { //unexpected value throw new \InvalidArgumentException( sprintf( 'Unexpected value for property %s: %s', $name, $iaex->getMessage() ), 0, $iaex ); } } } return $object; }
php
public function cast($object) { if (!is_object($object)) { throw new \InvalidArgumentException(sprintf('Expected an object, but got %s!', gettype($object))); } foreach ($this->map as $name => $type) { if (isset($object->{$name})) { try { $object->{$name} = $type->cast($object->{$name}); } catch (\InvalidArgumentException $iaex) { //unexpected value throw new \InvalidArgumentException( sprintf( 'Unexpected value for property %s: %s', $name, $iaex->getMessage() ), 0, $iaex ); } } } return $object; }
[ "public", "function", "cast", "(", "$", "object", ")", "{", "if", "(", "!", "is_object", "(", "$", "object", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Expected an object, but got %s!'", ",", "gettype", "(", "$", "object", ")", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "map", "as", "$", "name", "=>", "$", "type", ")", "{", "if", "(", "isset", "(", "$", "object", "->", "{", "$", "name", "}", ")", ")", "{", "try", "{", "$", "object", "->", "{", "$", "name", "}", "=", "$", "type", "->", "cast", "(", "$", "object", "->", "{", "$", "name", "}", ")", ";", "}", "catch", "(", "\\", "InvalidArgumentException", "$", "iaex", ")", "{", "//unexpected value", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Unexpected value for property %s: %s'", ",", "$", "name", ",", "$", "iaex", "->", "getMessage", "(", ")", ")", ",", "0", ",", "$", "iaex", ")", ";", "}", "}", "}", "return", "$", "object", ";", "}" ]
Cast the public values of the given object to the typecast information defined in this class. @param object $object The raw data to be typecasted. @return object The same data structure as the input, but casted to the typecasting information defined in this class. @throws \InvalidArgumentException in case the given value does not match the typecasting information defined in this class.
[ "Cast", "the", "public", "values", "of", "the", "given", "object", "to", "the", "typecast", "information", "defined", "in", "this", "class", "." ]
89939ad0dbf92f6ef09c48764347f473d51e8786
https://github.com/the-kbA-team/typecast/blob/89939ad0dbf92f6ef09c48764347f473d51e8786/src/TypeCastObject.php#L70-L94
10,054
ongr-archive/ContentBundle
Twig/CategoryExtension.php
CategoryExtension.renderCategoryTree
public function renderCategoryTree( \Twig_Environment $environment, $tree, $selectedCategory = null, $currentCategory = null, $template = null ) { if (count($tree)) { if ($template === null) { $template = $this->getTemplate(); } return $environment->render( $template, [ 'categories' => $tree, 'selected_category' => $selectedCategory, 'current_category' => $currentCategory, ] ); } return null; }
php
public function renderCategoryTree( \Twig_Environment $environment, $tree, $selectedCategory = null, $currentCategory = null, $template = null ) { if (count($tree)) { if ($template === null) { $template = $this->getTemplate(); } return $environment->render( $template, [ 'categories' => $tree, 'selected_category' => $selectedCategory, 'current_category' => $currentCategory, ] ); } return null; }
[ "public", "function", "renderCategoryTree", "(", "\\", "Twig_Environment", "$", "environment", ",", "$", "tree", ",", "$", "selectedCategory", "=", "null", ",", "$", "currentCategory", "=", "null", ",", "$", "template", "=", "null", ")", "{", "if", "(", "count", "(", "$", "tree", ")", ")", "{", "if", "(", "$", "template", "===", "null", ")", "{", "$", "template", "=", "$", "this", "->", "getTemplate", "(", ")", ";", "}", "return", "$", "environment", "->", "render", "(", "$", "template", ",", "[", "'categories'", "=>", "$", "tree", ",", "'selected_category'", "=>", "$", "selectedCategory", ",", "'current_category'", "=>", "$", "currentCategory", ",", "]", ")", ";", "}", "return", "null", ";", "}" ]
Renders category tree. @param \Twig_Environment $environment @param array|\ArrayIterator $tree @param string|null $selectedCategory @param string|null $currentCategory @param string|null $template @return null|string
[ "Renders", "category", "tree", "." ]
453a02c0c89c16f66dc9caed000243534dbeffa5
https://github.com/ongr-archive/ContentBundle/blob/453a02c0c89c16f66dc9caed000243534dbeffa5/Twig/CategoryExtension.php#L153-L176
10,055
kevindierkx/elicit
src/ApiManager.php
ApiManager.setupConnectionFactory
protected function setupConnectionFactory(ConnectionResolverInterface $connectionResolver) { Model::setConnectionResolver($connectionResolver); $this->connectionFactory = new ConnectionFactory($connectionResolver); }
php
protected function setupConnectionFactory(ConnectionResolverInterface $connectionResolver) { Model::setConnectionResolver($connectionResolver); $this->connectionFactory = new ConnectionFactory($connectionResolver); }
[ "protected", "function", "setupConnectionFactory", "(", "ConnectionResolverInterface", "$", "connectionResolver", ")", "{", "Model", "::", "setConnectionResolver", "(", "$", "connectionResolver", ")", ";", "$", "this", "->", "connectionFactory", "=", "new", "ConnectionFactory", "(", "$", "connectionResolver", ")", ";", "}" ]
Build the connection factory instance. @param ConnectionResolverInterface $connectionResolver
[ "Build", "the", "connection", "factory", "instance", "." ]
c277942f5f5f63b175bc37e9d392faa946888f65
https://github.com/kevindierkx/elicit/blob/c277942f5f5f63b175bc37e9d392faa946888f65/src/ApiManager.php#L40-L45
10,056
bellisq/type-map
src/DI/Storage/TypeDefinition.php
TypeDefinition.isSingleton
public function isSingleton($type): bool { assert(isset($this->types[$type])); return $this->types[$type]; }
php
public function isSingleton($type): bool { assert(isset($this->types[$type])); return $this->types[$type]; }
[ "public", "function", "isSingleton", "(", "$", "type", ")", ":", "bool", "{", "assert", "(", "isset", "(", "$", "this", "->", "types", "[", "$", "type", "]", ")", ")", ";", "return", "$", "this", "->", "types", "[", "$", "type", "]", ";", "}" ]
Only `DI\Provider` can call this function. So, `DI\Provider` is responsible to the assertion. @param $type @return bool
[ "Only", "DI", "\\", "Provider", "can", "call", "this", "function", ".", "So", "DI", "\\", "Provider", "is", "responsible", "to", "the", "assertion", "." ]
8a453cc3b0820a85d4f8a6ec2dd967ea800fa6f3
https://github.com/bellisq/type-map/blob/8a453cc3b0820a85d4f8a6ec2dd967ea800fa6f3/src/DI/Storage/TypeDefinition.php#L52-L56
10,057
guru-digital/ss-gdm-extensions
code/Extensions/SSGuru_ContentController.php
SSGuru_ContentController.Content
public function Content() { $content = $this->owner->Content; // Internal links. $matches = array(); preg_match_all('/<a.*href="\[file_link,id=([0-9]+)\].*".*>.*<\/a>/U', $content, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $file = DataObject::get_by_id('File', $matches[1][$i]); if ($file) { $size = $file->getSize(); $ext = strtoupper($file->getExtension()); $newLink = $matches[0][$i] . "<span class='fileExt'> [$ext, $size]</span>"; $content = str_replace($matches[0][$i], $newLink, $content); } } // and now external links $pattern = '/<a href=\"(h[^\"]*)\">(.*)<\/a>/iU'; $replacement = '<a href="$1" class="external">$2</a>'; $result = preg_replace($pattern, $replacement, $content, -1); return $result; }
php
public function Content() { $content = $this->owner->Content; // Internal links. $matches = array(); preg_match_all('/<a.*href="\[file_link,id=([0-9]+)\].*".*>.*<\/a>/U', $content, $matches); for ($i = 0; $i < count($matches[0]); $i++) { $file = DataObject::get_by_id('File', $matches[1][$i]); if ($file) { $size = $file->getSize(); $ext = strtoupper($file->getExtension()); $newLink = $matches[0][$i] . "<span class='fileExt'> [$ext, $size]</span>"; $content = str_replace($matches[0][$i], $newLink, $content); } } // and now external links $pattern = '/<a href=\"(h[^\"]*)\">(.*)<\/a>/iU'; $replacement = '<a href="$1" class="external">$2</a>'; $result = preg_replace($pattern, $replacement, $content, -1); return $result; }
[ "public", "function", "Content", "(", ")", "{", "$", "content", "=", "$", "this", "->", "owner", "->", "Content", ";", "// Internal links.", "$", "matches", "=", "array", "(", ")", ";", "preg_match_all", "(", "'/<a.*href=\"\\[file_link,id=([0-9]+)\\].*\".*>.*<\\/a>/U'", ",", "$", "content", ",", "$", "matches", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "matches", "[", "0", "]", ")", ";", "$", "i", "++", ")", "{", "$", "file", "=", "DataObject", "::", "get_by_id", "(", "'File'", ",", "$", "matches", "[", "1", "]", "[", "$", "i", "]", ")", ";", "if", "(", "$", "file", ")", "{", "$", "size", "=", "$", "file", "->", "getSize", "(", ")", ";", "$", "ext", "=", "strtoupper", "(", "$", "file", "->", "getExtension", "(", ")", ")", ";", "$", "newLink", "=", "$", "matches", "[", "0", "]", "[", "$", "i", "]", ".", "\"<span class='fileExt'> [$ext, $size]</span>\"", ";", "$", "content", "=", "str_replace", "(", "$", "matches", "[", "0", "]", "[", "$", "i", "]", ",", "$", "newLink", ",", "$", "content", ")", ";", "}", "}", "// and now external links", "$", "pattern", "=", "'/<a href=\\\"(h[^\\\"]*)\\\">(.*)<\\/a>/iU'", ";", "$", "replacement", "=", "'<a href=\"$1\" class=\"external\">$2</a>'", ";", "$", "result", "=", "preg_replace", "(", "$", "pattern", ",", "$", "replacement", ",", "$", "content", ",", "-", "1", ")", ";", "return", "$", "result", ";", "}" ]
Give external links the external class, and affix size and type prefixes to files. @return String
[ "Give", "external", "links", "the", "external", "class", "and", "affix", "size", "and", "type", "prefixes", "to", "files", "." ]
0ccb29ea11b6d3b9d1f488c8eccad1a0de085c67
https://github.com/guru-digital/ss-gdm-extensions/blob/0ccb29ea11b6d3b9d1f488c8eccad1a0de085c67/code/Extensions/SSGuru_ContentController.php#L66-L89
10,058
guru-digital/ss-gdm-extensions
code/Extensions/SSGuru_ContentController.php
SSGuru_ContentController.results
public function results($data, $form, $request) { $result = null; $results = $form->getResults(); $query = $form->getSearchQuery(); // Add context summaries based on the queries. foreach ($results as $result) { $contextualTitle = new Text(); $contextualTitle->setValue($result->MenuTitle ? $result->MenuTitle : $result->Title); $result->ContextualTitle = $contextualTitle->ContextSummary(300, $query); if (!$result->Content && $result->ClassName == 'File') { // Fake some content for the files. $result->ContextualContent = "A file named \"$result->Name\" ($result->Size)."; } else { // /(.?)\[embed(.*?)\](.+?)\[\/\s*embed\s*\](.?)/gi $valueField = $result->obj('Content'); $valueField->setValue(ShortcodeParser::get_active()->parse($valueField->getValue())); $result->ContextualContent = $valueField->ContextSummary(300, $query); } } $rssLink = HTTP::setGetVar('rss', '1'); // Render the result. $context = array( 'Results' => $results, 'Query' => $query, 'Title' => _t('SearchForm.SearchResults', 'Search Results'), 'RSSLink' => $rssLink ); // Choose the delivery method - rss or html. if (!$this->owner->request->getVar('rss')) { // Add RSS feed to normal search. RSSFeed::linkToFeed($rssLink, "Search results for query \"$query\"."); $result = $this->owner->customise($context)->renderWith(array('Page_results', 'Page')); } else { // De-paginate and reorder. Sort-by-relevancy doesn't make sense in RSS context. $fullList = $results->getList()->sort('LastEdited', 'DESC'); // Get some descriptive strings $siteName = SiteConfig::current_site_config()->Title; $siteTagline = SiteConfig::current_site_config()->Tagline; if ($siteName) { $title = "$siteName search results for query \"$query\"."; } else { $title = "Search results for query \"$query\"."; } // Generate the feed content. $rss = new RSSFeed($fullList, $this->owner->request->getURL(), $title, $siteTagline, "Title", "ContextualContent", null); $rss->setTemplate('Page_results_rss'); $result = $rss->outputToBrowser(); } return $result; }
php
public function results($data, $form, $request) { $result = null; $results = $form->getResults(); $query = $form->getSearchQuery(); // Add context summaries based on the queries. foreach ($results as $result) { $contextualTitle = new Text(); $contextualTitle->setValue($result->MenuTitle ? $result->MenuTitle : $result->Title); $result->ContextualTitle = $contextualTitle->ContextSummary(300, $query); if (!$result->Content && $result->ClassName == 'File') { // Fake some content for the files. $result->ContextualContent = "A file named \"$result->Name\" ($result->Size)."; } else { // /(.?)\[embed(.*?)\](.+?)\[\/\s*embed\s*\](.?)/gi $valueField = $result->obj('Content'); $valueField->setValue(ShortcodeParser::get_active()->parse($valueField->getValue())); $result->ContextualContent = $valueField->ContextSummary(300, $query); } } $rssLink = HTTP::setGetVar('rss', '1'); // Render the result. $context = array( 'Results' => $results, 'Query' => $query, 'Title' => _t('SearchForm.SearchResults', 'Search Results'), 'RSSLink' => $rssLink ); // Choose the delivery method - rss or html. if (!$this->owner->request->getVar('rss')) { // Add RSS feed to normal search. RSSFeed::linkToFeed($rssLink, "Search results for query \"$query\"."); $result = $this->owner->customise($context)->renderWith(array('Page_results', 'Page')); } else { // De-paginate and reorder. Sort-by-relevancy doesn't make sense in RSS context. $fullList = $results->getList()->sort('LastEdited', 'DESC'); // Get some descriptive strings $siteName = SiteConfig::current_site_config()->Title; $siteTagline = SiteConfig::current_site_config()->Tagline; if ($siteName) { $title = "$siteName search results for query \"$query\"."; } else { $title = "Search results for query \"$query\"."; } // Generate the feed content. $rss = new RSSFeed($fullList, $this->owner->request->getURL(), $title, $siteTagline, "Title", "ContextualContent", null); $rss->setTemplate('Page_results_rss'); $result = $rss->outputToBrowser(); } return $result; }
[ "public", "function", "results", "(", "$", "data", ",", "$", "form", ",", "$", "request", ")", "{", "$", "result", "=", "null", ";", "$", "results", "=", "$", "form", "->", "getResults", "(", ")", ";", "$", "query", "=", "$", "form", "->", "getSearchQuery", "(", ")", ";", "// Add context summaries based on the queries.", "foreach", "(", "$", "results", "as", "$", "result", ")", "{", "$", "contextualTitle", "=", "new", "Text", "(", ")", ";", "$", "contextualTitle", "->", "setValue", "(", "$", "result", "->", "MenuTitle", "?", "$", "result", "->", "MenuTitle", ":", "$", "result", "->", "Title", ")", ";", "$", "result", "->", "ContextualTitle", "=", "$", "contextualTitle", "->", "ContextSummary", "(", "300", ",", "$", "query", ")", ";", "if", "(", "!", "$", "result", "->", "Content", "&&", "$", "result", "->", "ClassName", "==", "'File'", ")", "{", "// Fake some content for the files.", "$", "result", "->", "ContextualContent", "=", "\"A file named \\\"$result->Name\\\" ($result->Size).\"", ";", "}", "else", "{", "// /(.?)\\[embed(.*?)\\](.+?)\\[\\/\\s*embed\\s*\\](.?)/gi", "$", "valueField", "=", "$", "result", "->", "obj", "(", "'Content'", ")", ";", "$", "valueField", "->", "setValue", "(", "ShortcodeParser", "::", "get_active", "(", ")", "->", "parse", "(", "$", "valueField", "->", "getValue", "(", ")", ")", ")", ";", "$", "result", "->", "ContextualContent", "=", "$", "valueField", "->", "ContextSummary", "(", "300", ",", "$", "query", ")", ";", "}", "}", "$", "rssLink", "=", "HTTP", "::", "setGetVar", "(", "'rss'", ",", "'1'", ")", ";", "// Render the result.", "$", "context", "=", "array", "(", "'Results'", "=>", "$", "results", ",", "'Query'", "=>", "$", "query", ",", "'Title'", "=>", "_t", "(", "'SearchForm.SearchResults'", ",", "'Search Results'", ")", ",", "'RSSLink'", "=>", "$", "rssLink", ")", ";", "// Choose the delivery method - rss or html.", "if", "(", "!", "$", "this", "->", "owner", "->", "request", "->", "getVar", "(", "'rss'", ")", ")", "{", "// Add RSS feed to normal search.", "RSSFeed", "::", "linkToFeed", "(", "$", "rssLink", ",", "\"Search results for query \\\"$query\\\".\"", ")", ";", "$", "result", "=", "$", "this", "->", "owner", "->", "customise", "(", "$", "context", ")", "->", "renderWith", "(", "array", "(", "'Page_results'", ",", "'Page'", ")", ")", ";", "}", "else", "{", "// De-paginate and reorder. Sort-by-relevancy doesn't make sense in RSS context.", "$", "fullList", "=", "$", "results", "->", "getList", "(", ")", "->", "sort", "(", "'LastEdited'", ",", "'DESC'", ")", ";", "// Get some descriptive strings", "$", "siteName", "=", "SiteConfig", "::", "current_site_config", "(", ")", "->", "Title", ";", "$", "siteTagline", "=", "SiteConfig", "::", "current_site_config", "(", ")", "->", "Tagline", ";", "if", "(", "$", "siteName", ")", "{", "$", "title", "=", "\"$siteName search results for query \\\"$query\\\".\"", ";", "}", "else", "{", "$", "title", "=", "\"Search results for query \\\"$query\\\".\"", ";", "}", "// Generate the feed content.", "$", "rss", "=", "new", "RSSFeed", "(", "$", "fullList", ",", "$", "this", "->", "owner", "->", "request", "->", "getURL", "(", ")", ",", "$", "title", ",", "$", "siteTagline", ",", "\"Title\"", ",", "\"ContextualContent\"", ",", "null", ")", ";", "$", "rss", "->", "setTemplate", "(", "'Page_results_rss'", ")", ";", "$", "result", "=", "$", "rss", "->", "outputToBrowser", "(", ")", ";", "}", "return", "$", "result", ";", "}" ]
Overrides the ContentControllerSearchExtension and adds snippets to results. @param array $data @param SearchForm $form @param SS_HTTPRequest $request @return HTMLText
[ "Overrides", "the", "ContentControllerSearchExtension", "and", "adds", "snippets", "to", "results", "." ]
0ccb29ea11b6d3b9d1f488c8eccad1a0de085c67
https://github.com/guru-digital/ss-gdm-extensions/blob/0ccb29ea11b6d3b9d1f488c8eccad1a0de085c67/code/Extensions/SSGuru_ContentController.php#L99-L157
10,059
aleksip/patternengine-php-tpl
src/aleksip/PatternEngine/Tpl/Loaders/StringLoader.php
StringLoader.render
public function render($options = array()) { $string = $options['string']; $data = $options['data']; return $this->renderTpl($string, $data); }
php
public function render($options = array()) { $string = $options['string']; $data = $options['data']; return $this->renderTpl($string, $data); }
[ "public", "function", "render", "(", "$", "options", "=", "array", "(", ")", ")", "{", "$", "string", "=", "$", "options", "[", "'string'", "]", ";", "$", "data", "=", "$", "options", "[", "'data'", "]", ";", "return", "$", "this", "->", "renderTpl", "(", "$", "string", ",", "$", "data", ")", ";", "}" ]
Render a string. @param array $options Options @return string The rendered result
[ "Render", "a", "string", "." ]
08b56cff240481855a012f85eb94b10ddb994d59
https://github.com/aleksip/patternengine-php-tpl/blob/08b56cff240481855a012f85eb94b10ddb994d59/src/aleksip/PatternEngine/Tpl/Loaders/StringLoader.php#L17-L23
10,060
easy-system/es-http
src/Uploading/MoveStrategy.php
MoveStrategy.setTargetDirectory
public function setTargetDirectory($dir) { if (! is_string($dir) || empty($dir)) { throw new InvalidArgumentException(sprintf( 'Invalid target directory provided; must be a non-empty ' . 'string, "%s" received.', is_object($dir) ? get_class($dir) : gettype($dir) )); } $this->targetDirectory = $dir; }
php
public function setTargetDirectory($dir) { if (! is_string($dir) || empty($dir)) { throw new InvalidArgumentException(sprintf( 'Invalid target directory provided; must be a non-empty ' . 'string, "%s" received.', is_object($dir) ? get_class($dir) : gettype($dir) )); } $this->targetDirectory = $dir; }
[ "public", "function", "setTargetDirectory", "(", "$", "dir", ")", "{", "if", "(", "!", "is_string", "(", "$", "dir", ")", "||", "empty", "(", "$", "dir", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid target directory provided; must be a non-empty '", ".", "'string, \"%s\" received.'", ",", "is_object", "(", "$", "dir", ")", "?", "get_class", "(", "$", "dir", ")", ":", "gettype", "(", "$", "dir", ")", ")", ")", ";", "}", "$", "this", "->", "targetDirectory", "=", "$", "dir", ";", "}" ]
Sets the target directory to move. If the upload options contains the "target_directory" key, this method will be called automatically. @param string $dir The target directory to move @throws \InvalidArgumentException If the provided directory is not non-empty string
[ "Sets", "the", "target", "directory", "to", "move", "." ]
dd5852e94901e147a7546a8715133408ece767a1
https://github.com/easy-system/es-http/blob/dd5852e94901e147a7546a8715133408ece767a1/src/Uploading/MoveStrategy.php#L69-L79
10,061
easy-system/es-http
src/Uploading/MoveStrategy.php
MoveStrategy.setFilePermissions
public function setFilePermissions($permissions) { if (! is_int($permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissins provided; must be an ' . 'integer, "%s" received.', is_object($permissions) ? get_class($permissions) : gettype($permissions) )); } if (! (0b100000000 & $permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will not available for reading.', decoct($permissions) )); } if (! (0b010000000 & $permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will not available for writing.', decoct($permissions) )); } if (0b001000000 & $permissions) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will be executable.', decoct($permissions) )); } $this->filePermissions = $permissions; }
php
public function setFilePermissions($permissions) { if (! is_int($permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissins provided; must be an ' . 'integer, "%s" received.', is_object($permissions) ? get_class($permissions) : gettype($permissions) )); } if (! (0b100000000 & $permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will not available for reading.', decoct($permissions) )); } if (! (0b010000000 & $permissions)) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will not available for writing.', decoct($permissions) )); } if (0b001000000 & $permissions) { throw new InvalidArgumentException(sprintf( 'Invalid file permissions "%s" provided. ' . 'Files will be executable.', decoct($permissions) )); } $this->filePermissions = $permissions; }
[ "public", "function", "setFilePermissions", "(", "$", "permissions", ")", "{", "if", "(", "!", "is_int", "(", "$", "permissions", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid file permissins provided; must be an '", ".", "'integer, \"%s\" received.'", ",", "is_object", "(", "$", "permissions", ")", "?", "get_class", "(", "$", "permissions", ")", ":", "gettype", "(", "$", "permissions", ")", ")", ")", ";", "}", "if", "(", "!", "(", "0b100000000", "&", "$", "permissions", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid file permissions \"%s\" provided. '", ".", "'Files will not available for reading.'", ",", "decoct", "(", "$", "permissions", ")", ")", ")", ";", "}", "if", "(", "!", "(", "0b010000000", "&", "$", "permissions", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid file permissions \"%s\" provided. '", ".", "'Files will not available for writing.'", ",", "decoct", "(", "$", "permissions", ")", ")", ")", ";", "}", "if", "(", "0b001000000", "&", "$", "permissions", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid file permissions \"%s\" provided. '", ".", "'Files will be executable.'", ",", "decoct", "(", "$", "permissions", ")", ")", ")", ";", "}", "$", "this", "->", "filePermissions", "=", "$", "permissions", ";", "}" ]
Sets the file permissions. If the upload options contains the "file_permissions" key, this method will be called automatically. @param int $permissions The permissions of files in the new location @throws \InvalidArgumentException - If specified permissions are non integer - If specified permissions are not readable - If specified permissions are not writable - If specified permissions are executable
[ "Sets", "the", "file", "permissions", "." ]
dd5852e94901e147a7546a8715133408ece767a1
https://github.com/easy-system/es-http/blob/dd5852e94901e147a7546a8715133408ece767a1/src/Uploading/MoveStrategy.php#L106-L138
10,062
psiphp/content-type
bridge/doctrine-phpcr-odm/src/NodeTypeRegistrator.php
NodeTypeRegistrator.registerNodeTypes
public function registerNodeTypes(SessionInterface $session) { $cnd = sprintf( '<%s=\'https://github.com/symfony-cmf/content-type\'>', $this->encoder->getPrefix(), $this->encoder->getUri() ); $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager(); $nodeTypeManager->registerNodeTypesCnd($cnd, true); }
php
public function registerNodeTypes(SessionInterface $session) { $cnd = sprintf( '<%s=\'https://github.com/symfony-cmf/content-type\'>', $this->encoder->getPrefix(), $this->encoder->getUri() ); $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager(); $nodeTypeManager->registerNodeTypesCnd($cnd, true); }
[ "public", "function", "registerNodeTypes", "(", "SessionInterface", "$", "session", ")", "{", "$", "cnd", "=", "sprintf", "(", "'<%s=\\'https://github.com/symfony-cmf/content-type\\'>'", ",", "$", "this", "->", "encoder", "->", "getPrefix", "(", ")", ",", "$", "this", "->", "encoder", "->", "getUri", "(", ")", ")", ";", "$", "nodeTypeManager", "=", "$", "session", "->", "getWorkspace", "(", ")", "->", "getNodeTypeManager", "(", ")", ";", "$", "nodeTypeManager", "->", "registerNodeTypesCnd", "(", "$", "cnd", ",", "true", ")", ";", "}" ]
Register the content-type node types with the given PHPCR session.
[ "Register", "the", "content", "-", "type", "node", "types", "with", "the", "given", "PHPCR", "session", "." ]
331f36f45eb45763859375bf80e2604bfe3e2940
https://github.com/psiphp/content-type/blob/331f36f45eb45763859375bf80e2604bfe3e2940/bridge/doctrine-phpcr-odm/src/NodeTypeRegistrator.php#L24-L34
10,063
fortrabbit/datafilter
src/DataFilter/Util.php
Util.flatten
public static function flatten($data, $flat = array(), $prefix = '') { foreach ($data as $key => $value) { // is array -> flatten deeped if (is_array($value)) { $flat = self::flatten($value, $flat, $prefix. $key. self::$FLATTEN_SEPARATOR); } // scalar -> use else { $flat[$prefix. $key] = $value; } } return $flat; }
php
public static function flatten($data, $flat = array(), $prefix = '') { foreach ($data as $key => $value) { // is array -> flatten deeped if (is_array($value)) { $flat = self::flatten($value, $flat, $prefix. $key. self::$FLATTEN_SEPARATOR); } // scalar -> use else { $flat[$prefix. $key] = $value; } } return $flat; }
[ "public", "static", "function", "flatten", "(", "$", "data", ",", "$", "flat", "=", "array", "(", ")", ",", "$", "prefix", "=", "''", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "// is array -> flatten deeped", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "flat", "=", "self", "::", "flatten", "(", "$", "value", ",", "$", "flat", ",", "$", "prefix", ".", "$", "key", ".", "self", "::", "$", "FLATTEN_SEPARATOR", ")", ";", "}", "// scalar -> use", "else", "{", "$", "flat", "[", "$", "prefix", ".", "$", "key", "]", "=", "$", "value", ";", "}", "}", "return", "$", "flat", ";", "}" ]
Flattens input data @param string $str Input string @param array $args Variables to be replaced @return array
[ "Flattens", "input", "data" ]
fca1c2cbd299f3762b251134d8a62038fb7defe3
https://github.com/fortrabbit/datafilter/blob/fca1c2cbd299f3762b251134d8a62038fb7defe3/src/DataFilter/Util.php#L50-L64
10,064
Innmind/RestBundle
EventListener/CapabilitiesResponseListener.php
CapabilitiesResponseListener.buildResponse
public function buildResponse(GetResponseForControllerResultEvent $event) { $request = $event->getRequest(); if ( !$request->attributes->has(RouteKeys::ACTION) || $request->attributes->get(RouteKeys::ACTION) !== 'capabilities' ) { return; } $routes = $event->getControllerResult(); $response = new Response; $links = $response->headers->get('Link', null, false); foreach ($routes as $name => $route) { $definition = $route->getDefault(RouteKeys::DEFINITION); list($collection, $resource) = explode('::', $definition); $definition = $this ->registry ->getCollection($collection) ->getResource($resource); $links[] = sprintf( '<%s>; rel="endpoint"; name="%s_%s"', $this->urlGenerator->generate($name), $definition->getCollection(), $definition ); } $response->headers->add(['Link' => $links]); $event->setResponse($response); }
php
public function buildResponse(GetResponseForControllerResultEvent $event) { $request = $event->getRequest(); if ( !$request->attributes->has(RouteKeys::ACTION) || $request->attributes->get(RouteKeys::ACTION) !== 'capabilities' ) { return; } $routes = $event->getControllerResult(); $response = new Response; $links = $response->headers->get('Link', null, false); foreach ($routes as $name => $route) { $definition = $route->getDefault(RouteKeys::DEFINITION); list($collection, $resource) = explode('::', $definition); $definition = $this ->registry ->getCollection($collection) ->getResource($resource); $links[] = sprintf( '<%s>; rel="endpoint"; name="%s_%s"', $this->urlGenerator->generate($name), $definition->getCollection(), $definition ); } $response->headers->add(['Link' => $links]); $event->setResponse($response); }
[ "public", "function", "buildResponse", "(", "GetResponseForControllerResultEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "request", "->", "attributes", "->", "has", "(", "RouteKeys", "::", "ACTION", ")", "||", "$", "request", "->", "attributes", "->", "get", "(", "RouteKeys", "::", "ACTION", ")", "!==", "'capabilities'", ")", "{", "return", ";", "}", "$", "routes", "=", "$", "event", "->", "getControllerResult", "(", ")", ";", "$", "response", "=", "new", "Response", ";", "$", "links", "=", "$", "response", "->", "headers", "->", "get", "(", "'Link'", ",", "null", ",", "false", ")", ";", "foreach", "(", "$", "routes", "as", "$", "name", "=>", "$", "route", ")", "{", "$", "definition", "=", "$", "route", "->", "getDefault", "(", "RouteKeys", "::", "DEFINITION", ")", ";", "list", "(", "$", "collection", ",", "$", "resource", ")", "=", "explode", "(", "'::'", ",", "$", "definition", ")", ";", "$", "definition", "=", "$", "this", "->", "registry", "->", "getCollection", "(", "$", "collection", ")", "->", "getResource", "(", "$", "resource", ")", ";", "$", "links", "[", "]", "=", "sprintf", "(", "'<%s>; rel=\"endpoint\"; name=\"%s_%s\"'", ",", "$", "this", "->", "urlGenerator", "->", "generate", "(", "$", "name", ")", ",", "$", "definition", "->", "getCollection", "(", ")", ",", "$", "definition", ")", ";", "}", "$", "response", "->", "headers", "->", "add", "(", "[", "'Link'", "=>", "$", "links", "]", ")", ";", "$", "event", "->", "setResponse", "(", "$", "response", ")", ";", "}" ]
Build the response to expose all routes of the API @param GetResponseForControllerResultEvent $event @return void
[ "Build", "the", "response", "to", "expose", "all", "routes", "of", "the", "API" ]
46de57d9b45dfbfcf98867be3c601fba57f2edc2
https://github.com/Innmind/RestBundle/blob/46de57d9b45dfbfcf98867be3c601fba57f2edc2/EventListener/CapabilitiesResponseListener.php#L43-L76
10,065
osflab/controller
Response/Type.php
Type.setType
public function setType(string $type):self { if (!isset($this->types[$type])) { Checkers::notice('Unknown response type [' . $type . ']'); } else { $this->type = $type; } return $this; }
php
public function setType(string $type):self { if (!isset($this->types[$type])) { Checkers::notice('Unknown response type [' . $type . ']'); } else { $this->type = $type; } return $this; }
[ "public", "function", "setType", "(", "string", "$", "type", ")", ":", "self", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "types", "[", "$", "type", "]", ")", ")", "{", "Checkers", "::", "notice", "(", "'Unknown response type ['", ".", "$", "type", ".", "']'", ")", ";", "}", "else", "{", "$", "this", "->", "type", "=", "$", "type", ";", "}", "return", "$", "this", ";", "}" ]
Content-Type @param string $type @return $this
[ "Content", "-", "Type" ]
d59344fc204a74995224e3da39b9debd78fdb974
https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Response/Type.php#L36-L44
10,066
osflab/controller
Response/Type.php
Type.setDisposition
public function setDisposition(string $dispositionType, $filename = null, $name = null) { if (!in_array($dispositionType, $this->dispositions)) { Checkers::notice('Unknown response type [' . $type . ']'); } else { $this->disposition['type'] = $dispositionType; } if ($filename !== null) { $this->disposition['filename'] = (string) $filename; } if ($name !== null) { $this->disposition['name'] = (string) $name; } return $this; }
php
public function setDisposition(string $dispositionType, $filename = null, $name = null) { if (!in_array($dispositionType, $this->dispositions)) { Checkers::notice('Unknown response type [' . $type . ']'); } else { $this->disposition['type'] = $dispositionType; } if ($filename !== null) { $this->disposition['filename'] = (string) $filename; } if ($name !== null) { $this->disposition['name'] = (string) $name; } return $this; }
[ "public", "function", "setDisposition", "(", "string", "$", "dispositionType", ",", "$", "filename", "=", "null", ",", "$", "name", "=", "null", ")", "{", "if", "(", "!", "in_array", "(", "$", "dispositionType", ",", "$", "this", "->", "dispositions", ")", ")", "{", "Checkers", "::", "notice", "(", "'Unknown response type ['", ".", "$", "type", ".", "']'", ")", ";", "}", "else", "{", "$", "this", "->", "disposition", "[", "'type'", "]", "=", "$", "dispositionType", ";", "}", "if", "(", "$", "filename", "!==", "null", ")", "{", "$", "this", "->", "disposition", "[", "'filename'", "]", "=", "(", "string", ")", "$", "filename", ";", "}", "if", "(", "$", "name", "!==", "null", ")", "{", "$", "this", "->", "disposition", "[", "'name'", "]", "=", "(", "string", ")", "$", "name", ";", "}", "return", "$", "this", ";", "}" ]
Content-Disposition @param string $dispositionType @param string $filename @param string $name @return $this
[ "Content", "-", "Disposition" ]
d59344fc204a74995224e3da39b9debd78fdb974
https://github.com/osflab/controller/blob/d59344fc204a74995224e3da39b9debd78fdb974/Response/Type.php#L117-L131
10,067
bytic/database
src/Adapters/MySQLi.php
MySQLi.connect
public function connect($host = false, $user = false, $password = false, $database = false, $newLink = false) { $this->connection = mysqli_connect($host, $user, $password, $newLink); if ($this->connection) { if ($this->selectDatabase($database)) { $this->query("SET CHARACTER SET utf8"); $this->query("SET NAMES utf8"); return $this->connection; } else { $message = 'Cannot select database ' . $database; } } else { $message = mysqli_error($this->connection); } if (!$this->connection) { trigger_error($message, E_USER_WARNING); } }
php
public function connect($host = false, $user = false, $password = false, $database = false, $newLink = false) { $this->connection = mysqli_connect($host, $user, $password, $newLink); if ($this->connection) { if ($this->selectDatabase($database)) { $this->query("SET CHARACTER SET utf8"); $this->query("SET NAMES utf8"); return $this->connection; } else { $message = 'Cannot select database ' . $database; } } else { $message = mysqli_error($this->connection); } if (!$this->connection) { trigger_error($message, E_USER_WARNING); } }
[ "public", "function", "connect", "(", "$", "host", "=", "false", ",", "$", "user", "=", "false", ",", "$", "password", "=", "false", ",", "$", "database", "=", "false", ",", "$", "newLink", "=", "false", ")", "{", "$", "this", "->", "connection", "=", "mysqli_connect", "(", "$", "host", ",", "$", "user", ",", "$", "password", ",", "$", "newLink", ")", ";", "if", "(", "$", "this", "->", "connection", ")", "{", "if", "(", "$", "this", "->", "selectDatabase", "(", "$", "database", ")", ")", "{", "$", "this", "->", "query", "(", "\"SET CHARACTER SET utf8\"", ")", ";", "$", "this", "->", "query", "(", "\"SET NAMES utf8\"", ")", ";", "return", "$", "this", "->", "connection", ";", "}", "else", "{", "$", "message", "=", "'Cannot select database '", ".", "$", "database", ";", "}", "}", "else", "{", "$", "message", "=", "mysqli_error", "(", "$", "this", "->", "connection", ")", ";", "}", "if", "(", "!", "$", "this", "->", "connection", ")", "{", "trigger_error", "(", "$", "message", ",", "E_USER_WARNING", ")", ";", "}", "}" ]
Connects to MySQL server @param string|boolean $host @param string|boolean $user @param string|boolean $password @param string|boolean $database @param bool $newLink @return resource
[ "Connects", "to", "MySQL", "server" ]
186a7f1ae4fe2d8fa79acc34c06cfacd91488fa4
https://github.com/bytic/database/blob/186a7f1ae4fe2d8fa79acc34c06cfacd91488fa4/src/Adapters/MySQLi.php#L24-L43
10,068
Smile-SA/EzToolsBundle
Command/ContentTypeGroup/GenerateCommand.php
GenerateCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { /** @var $repository Repository */ $repository = $this->getContainer()->get('ezpublish.api.repository'); /** @var $questionHelper QuestionHelper */ $questionHelper = $this->getHelper('question'); $question = new Question('Content type group name: '); $question->setValidator( array( 'Smile\EzToolsBundle\Command\ContentTypeGroup\Validators', 'validateContentTypeGroupName' ) ); $contentTypeGroupName = false; while(!$contentTypeGroupName) { $contentTypeGroupName = $questionHelper->ask($input, $output, $question); if (!$contentTypeGroupName || empty($contentTypeGroupName)) { $output->writeln("<error>Content type group name should only contains numbers, letters or space</error>"); } } /** @var $configResolver ConfigResolver */ $configResolver = $this->getContainer()->get('ezpublish.config.resolver'); $adminID = $configResolver->getParameter('adminid', 'smile_ez_tools'); $contentTypeGroupService = new ContentTypeGroup($repository); $contentTypeGroupService->setAdminID($adminID); try { $contentTypeGroupService->add($contentTypeGroupName); $output->writeln( "<info>Content type group created '$contentTypeGroupName'<info>"); } catch( UnauthorizedException $e) { $output->writeln( "<error>" . $e->getMessage() . "</error>" ); } catch (ForbiddenException $e ) { $output->writeln( "<error>" . $e->getMessage() . "</error>" ); } }
php
protected function execute(InputInterface $input, OutputInterface $output) { /** @var $repository Repository */ $repository = $this->getContainer()->get('ezpublish.api.repository'); /** @var $questionHelper QuestionHelper */ $questionHelper = $this->getHelper('question'); $question = new Question('Content type group name: '); $question->setValidator( array( 'Smile\EzToolsBundle\Command\ContentTypeGroup\Validators', 'validateContentTypeGroupName' ) ); $contentTypeGroupName = false; while(!$contentTypeGroupName) { $contentTypeGroupName = $questionHelper->ask($input, $output, $question); if (!$contentTypeGroupName || empty($contentTypeGroupName)) { $output->writeln("<error>Content type group name should only contains numbers, letters or space</error>"); } } /** @var $configResolver ConfigResolver */ $configResolver = $this->getContainer()->get('ezpublish.config.resolver'); $adminID = $configResolver->getParameter('adminid', 'smile_ez_tools'); $contentTypeGroupService = new ContentTypeGroup($repository); $contentTypeGroupService->setAdminID($adminID); try { $contentTypeGroupService->add($contentTypeGroupName); $output->writeln( "<info>Content type group created '$contentTypeGroupName'<info>"); } catch( UnauthorizedException $e) { $output->writeln( "<error>" . $e->getMessage() . "</error>" ); } catch (ForbiddenException $e ) { $output->writeln( "<error>" . $e->getMessage() . "</error>" ); } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "/** @var $repository Repository */", "$", "repository", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'ezpublish.api.repository'", ")", ";", "/** @var $questionHelper QuestionHelper */", "$", "questionHelper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "$", "question", "=", "new", "Question", "(", "'Content type group name: '", ")", ";", "$", "question", "->", "setValidator", "(", "array", "(", "'Smile\\EzToolsBundle\\Command\\ContentTypeGroup\\Validators'", ",", "'validateContentTypeGroupName'", ")", ")", ";", "$", "contentTypeGroupName", "=", "false", ";", "while", "(", "!", "$", "contentTypeGroupName", ")", "{", "$", "contentTypeGroupName", "=", "$", "questionHelper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ";", "if", "(", "!", "$", "contentTypeGroupName", "||", "empty", "(", "$", "contentTypeGroupName", ")", ")", "{", "$", "output", "->", "writeln", "(", "\"<error>Content type group name should only contains numbers, letters or space</error>\"", ")", ";", "}", "}", "/** @var $configResolver ConfigResolver */", "$", "configResolver", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'ezpublish.config.resolver'", ")", ";", "$", "adminID", "=", "$", "configResolver", "->", "getParameter", "(", "'adminid'", ",", "'smile_ez_tools'", ")", ";", "$", "contentTypeGroupService", "=", "new", "ContentTypeGroup", "(", "$", "repository", ")", ";", "$", "contentTypeGroupService", "->", "setAdminID", "(", "$", "adminID", ")", ";", "try", "{", "$", "contentTypeGroupService", "->", "add", "(", "$", "contentTypeGroupName", ")", ";", "$", "output", "->", "writeln", "(", "\"<info>Content type group created '$contentTypeGroupName'<info>\"", ")", ";", "}", "catch", "(", "UnauthorizedException", "$", "e", ")", "{", "$", "output", "->", "writeln", "(", "\"<error>\"", ".", "$", "e", "->", "getMessage", "(", ")", ".", "\"</error>\"", ")", ";", "}", "catch", "(", "ForbiddenException", "$", "e", ")", "{", "$", "output", "->", "writeln", "(", "\"<error>\"", ".", "$", "e", "->", "getMessage", "(", ")", ".", "\"</error>\"", ")", ";", "}", "}" ]
Execute ContentTypeGroup generate command @param InputInterface $input @param OutputInterface $output @return int|null|void
[ "Execute", "ContentTypeGroup", "generate", "command" ]
5f384f552a83dd723fb4dca468ac0a2e56442be8
https://github.com/Smile-SA/EzToolsBundle/blob/5f384f552a83dd723fb4dca468ac0a2e56442be8/Command/ContentTypeGroup/GenerateCommand.php#L35-L74
10,069
Softpampa/moip-sdk-php
src/Subscriptions/Resources/Customers.php
Customers.updateBillingInfo
public function updateBillingInfo($code = null, $data = []) { $payload = []; if (! $code) { $code = $this->data->code; } if (! empty($data)) { $payload['credit_card'] = $data; } elseif (isset($this->data->billing_info)) { $payload = $this->data->billing_info; } $this->client->put('/{code}/billing_infos', [$code], $payload); return $this; }
php
public function updateBillingInfo($code = null, $data = []) { $payload = []; if (! $code) { $code = $this->data->code; } if (! empty($data)) { $payload['credit_card'] = $data; } elseif (isset($this->data->billing_info)) { $payload = $this->data->billing_info; } $this->client->put('/{code}/billing_infos', [$code], $payload); return $this; }
[ "public", "function", "updateBillingInfo", "(", "$", "code", "=", "null", ",", "$", "data", "=", "[", "]", ")", "{", "$", "payload", "=", "[", "]", ";", "if", "(", "!", "$", "code", ")", "{", "$", "code", "=", "$", "this", "->", "data", "->", "code", ";", "}", "if", "(", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "payload", "[", "'credit_card'", "]", "=", "$", "data", ";", "}", "elseif", "(", "isset", "(", "$", "this", "->", "data", "->", "billing_info", ")", ")", "{", "$", "payload", "=", "$", "this", "->", "data", "->", "billing_info", ";", "}", "$", "this", "->", "client", "->", "put", "(", "'/{code}/billing_infos'", ",", "[", "$", "code", "]", ",", "$", "payload", ")", ";", "return", "$", "this", ";", "}" ]
Update Billing info @param string $code @param array $data @return $this
[ "Update", "Billing", "info" ]
621a71bd2ef1f9b690cd3431507af608152f6ad2
https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Subscriptions/Resources/Customers.php#L112-L129
10,070
Softpampa/moip-sdk-php
src/Subscriptions/Resources/Customers.php
Customers.setBirthdate
public function setBirthdate($birthdate) { $date = DateTime::createFromFormat('Y-m-d', $birthdate); $this->data->birthdate_day = $date->format('d'); $this->data->birthdate_month = $date->format('m'); $this->data->birthdate_year = $date->format('Y'); return $this; }
php
public function setBirthdate($birthdate) { $date = DateTime::createFromFormat('Y-m-d', $birthdate); $this->data->birthdate_day = $date->format('d'); $this->data->birthdate_month = $date->format('m'); $this->data->birthdate_year = $date->format('Y'); return $this; }
[ "public", "function", "setBirthdate", "(", "$", "birthdate", ")", "{", "$", "date", "=", "DateTime", "::", "createFromFormat", "(", "'Y-m-d'", ",", "$", "birthdate", ")", ";", "$", "this", "->", "data", "->", "birthdate_day", "=", "$", "date", "->", "format", "(", "'d'", ")", ";", "$", "this", "->", "data", "->", "birthdate_month", "=", "$", "date", "->", "format", "(", "'m'", ")", ";", "$", "this", "->", "data", "->", "birthdate_year", "=", "$", "date", "->", "format", "(", "'Y'", ")", ";", "return", "$", "this", ";", "}" ]
Set customer birthday @param string $birthdate @return $this
[ "Set", "customer", "birthday" ]
621a71bd2ef1f9b690cd3431507af608152f6ad2
https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Subscriptions/Resources/Customers.php#L203-L212
10,071
Softpampa/moip-sdk-php
src/Subscriptions/Resources/Customers.php
Customers.setBillingInfo
public function setBillingInfo($holderName, $number, $expirationMonth, $expirationYear) { $this->client->addQueryString('new_vault', true); $this->data->billing_info = new stdClass; $creditCard = $this->data->billing_info->credit_card = new stdClass; $creditCard->holder_name = $holderName; $creditCard->number = $number; $creditCard->expiration_month = $expirationMonth; $creditCard->expiration_year = $expirationYear; return $this; }
php
public function setBillingInfo($holderName, $number, $expirationMonth, $expirationYear) { $this->client->addQueryString('new_vault', true); $this->data->billing_info = new stdClass; $creditCard = $this->data->billing_info->credit_card = new stdClass; $creditCard->holder_name = $holderName; $creditCard->number = $number; $creditCard->expiration_month = $expirationMonth; $creditCard->expiration_year = $expirationYear; return $this; }
[ "public", "function", "setBillingInfo", "(", "$", "holderName", ",", "$", "number", ",", "$", "expirationMonth", ",", "$", "expirationYear", ")", "{", "$", "this", "->", "client", "->", "addQueryString", "(", "'new_vault'", ",", "true", ")", ";", "$", "this", "->", "data", "->", "billing_info", "=", "new", "stdClass", ";", "$", "creditCard", "=", "$", "this", "->", "data", "->", "billing_info", "->", "credit_card", "=", "new", "stdClass", ";", "$", "creditCard", "->", "holder_name", "=", "$", "holderName", ";", "$", "creditCard", "->", "number", "=", "$", "number", ";", "$", "creditCard", "->", "expiration_month", "=", "$", "expirationMonth", ";", "$", "creditCard", "->", "expiration_year", "=", "$", "expirationYear", ";", "return", "$", "this", ";", "}" ]
Set customer billing info @param string $holderName @param string $number @param string $expirationMonth @param string $expirationYear @return $this
[ "Set", "customer", "billing", "info" ]
621a71bd2ef1f9b690cd3431507af608152f6ad2
https://github.com/Softpampa/moip-sdk-php/blob/621a71bd2ef1f9b690cd3431507af608152f6ad2/src/Subscriptions/Resources/Customers.php#L237-L250
10,072
TangoMan75/JWTBundle
Model/JWT.php
JWT.get
public function get($key) { // return $this->claims['data'][$key] ?? null; if (isset($this->claims['data'][$key])) { return $this->claims['data'][$key]; } else { return null; } }
php
public function get($key) { // return $this->claims['data'][$key] ?? null; if (isset($this->claims['data'][$key])) { return $this->claims['data'][$key]; } else { return null; } }
[ "public", "function", "get", "(", "$", "key", ")", "{", "// return $this->claims['data'][$key] ?? null;", "if", "(", "isset", "(", "$", "this", "->", "claims", "[", "'data'", "]", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "claims", "[", "'data'", "]", "[", "$", "key", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Get token private claim @return array
[ "Get", "token", "private", "claim" ]
f201ad96c19ad28f0150c7cd05216e9fffb806ba
https://github.com/TangoMan75/JWTBundle/blob/f201ad96c19ad28f0150c7cd05216e9fffb806ba/Model/JWT.php#L66-L75
10,073
TangoMan75/JWTBundle
Model/JWT.php
JWT.setPeriod
public function setPeriod(\DateTime $start = null, \DateTime $end = null) { $this->claims['nbf'] = $start->getTimestamp(); $this->claims['exp'] = $end->getTimestamp(); return $this; }
php
public function setPeriod(\DateTime $start = null, \DateTime $end = null) { $this->claims['nbf'] = $start->getTimestamp(); $this->claims['exp'] = $end->getTimestamp(); return $this; }
[ "public", "function", "setPeriod", "(", "\\", "DateTime", "$", "start", "=", "null", ",", "\\", "DateTime", "$", "end", "=", "null", ")", "{", "$", "this", "->", "claims", "[", "'nbf'", "]", "=", "$", "start", "->", "getTimestamp", "(", ")", ";", "$", "this", "->", "claims", "[", "'exp'", "]", "=", "$", "end", "->", "getTimestamp", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets token expiration period @param \DateTime|null $start @param \DateTime|null $end @return JWT
[ "Sets", "token", "expiration", "period" ]
f201ad96c19ad28f0150c7cd05216e9fffb806ba
https://github.com/TangoMan75/JWTBundle/blob/f201ad96c19ad28f0150c7cd05216e9fffb806ba/Model/JWT.php#L114-L120
10,074
FuturaSoft/Pabana
src/Database/ConnectionCollection.php
ConnectionCollection.add
public static function add($connection, $setAsDefault = false) { $connectionName = $connection->getName(); self::$connectionList[$connectionName] = $connection; if ($setAsDefault === true) { self::setDefault($connectionName); } }
php
public static function add($connection, $setAsDefault = false) { $connectionName = $connection->getName(); self::$connectionList[$connectionName] = $connection; if ($setAsDefault === true) { self::setDefault($connectionName); } }
[ "public", "static", "function", "add", "(", "$", "connection", ",", "$", "setAsDefault", "=", "false", ")", "{", "$", "connectionName", "=", "$", "connection", "->", "getName", "(", ")", ";", "self", "::", "$", "connectionList", "[", "$", "connectionName", "]", "=", "$", "connection", ";", "if", "(", "$", "setAsDefault", "===", "true", ")", "{", "self", "::", "setDefault", "(", "$", "connectionName", ")", ";", "}", "}" ]
Add a connection to collection Store Connection to collection and defined it by default if would @since 1.0 @param \Pabana\Database\Connection $connection Object defined a connection and its parameters. @param bool $setAsDefault If defined connection will be defined as default connection. @return void
[ "Add", "a", "connection", "to", "collection" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Database/ConnectionCollection.php#L46-L53
10,075
FuturaSoft/Pabana
src/Database/ConnectionCollection.php
ConnectionCollection.get
public static function get($connectionName) { if (self::exists($connectionName) === true) { return self::$connectionList[$connectionName]; } else { throw new Exception('Datasource "' . $connectionName . '" isn\'t defined in DatasourceCollection'); return false; } }
php
public static function get($connectionName) { if (self::exists($connectionName) === true) { return self::$connectionList[$connectionName]; } else { throw new Exception('Datasource "' . $connectionName . '" isn\'t defined in DatasourceCollection'); return false; } }
[ "public", "static", "function", "get", "(", "$", "connectionName", ")", "{", "if", "(", "self", "::", "exists", "(", "$", "connectionName", ")", "===", "true", ")", "{", "return", "self", "::", "$", "connectionList", "[", "$", "connectionName", "]", ";", "}", "else", "{", "throw", "new", "Exception", "(", "'Datasource \"'", ".", "$", "connectionName", ".", "'\" isn\\'t defined in DatasourceCollection'", ")", ";", "return", "false", ";", "}", "}" ]
Get connection by his name @since 1.0 @param string $connectionName Connection who will get. @return bool|\Pabana\Database\Connection Return Connection object if exist or return false.
[ "Get", "connection", "by", "his", "name" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Database/ConnectionCollection.php#L89-L97
10,076
FuturaSoft/Pabana
src/Database/ConnectionCollection.php
ConnectionCollection.getDefault
public static function getDefault() { if (self::existsDefault()) { $defaultConnectionName = self::$defaultConnectionName; return self::$connectionList[$defaultConnectionName]; } else { throw new Exception('Datasource "' . $defaultConnectionName . '" isn\'t defined in DatasourceCollection'); return false; } }
php
public static function getDefault() { if (self::existsDefault()) { $defaultConnectionName = self::$defaultConnectionName; return self::$connectionList[$defaultConnectionName]; } else { throw new Exception('Datasource "' . $defaultConnectionName . '" isn\'t defined in DatasourceCollection'); return false; } }
[ "public", "static", "function", "getDefault", "(", ")", "{", "if", "(", "self", "::", "existsDefault", "(", ")", ")", "{", "$", "defaultConnectionName", "=", "self", "::", "$", "defaultConnectionName", ";", "return", "self", "::", "$", "connectionList", "[", "$", "defaultConnectionName", "]", ";", "}", "else", "{", "throw", "new", "Exception", "(", "'Datasource \"'", ".", "$", "defaultConnectionName", ".", "'\" isn\\'t defined in DatasourceCollection'", ")", ";", "return", "false", ";", "}", "}" ]
Get default connection @since 1.0 @return bool|\Pabana\Database\Connection Return default Connection object if exist or return false.
[ "Get", "default", "connection" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Database/ConnectionCollection.php#L105-L114
10,077
FuturaSoft/Pabana
src/Database/ConnectionCollection.php
ConnectionCollection.setDefault
public static function setDefault($connectionName, $force = true) { if ($force === false && self::existsDefault() === true) { throw new Exception('A default Datasource is already defined.'); return false; } else { self::$defaultConnectionName = $connectionName; return true; } }
php
public static function setDefault($connectionName, $force = true) { if ($force === false && self::existsDefault() === true) { throw new Exception('A default Datasource is already defined.'); return false; } else { self::$defaultConnectionName = $connectionName; return true; } }
[ "public", "static", "function", "setDefault", "(", "$", "connectionName", ",", "$", "force", "=", "true", ")", "{", "if", "(", "$", "force", "===", "false", "&&", "self", "::", "existsDefault", "(", ")", "===", "true", ")", "{", "throw", "new", "Exception", "(", "'A default Datasource is already defined.'", ")", ";", "return", "false", ";", "}", "else", "{", "self", "::", "$", "defaultConnectionName", "=", "$", "connectionName", ";", "return", "true", ";", "}", "}" ]
Set default connection Set default connection name and can force it set @since 1.0 @param string $connectionName Connection name who will be set by default. @param bool $force Force change of default connection. @return bool Return true if success or false if error.
[ "Set", "default", "connection" ]
b3a95eeb976042ac2a393cc10755a7adbc164c24
https://github.com/FuturaSoft/Pabana/blob/b3a95eeb976042ac2a393cc10755a7adbc164c24/src/Database/ConnectionCollection.php#L137-L146
10,078
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationCategoryByID
public function findAssociationCategoryByID($id) { $categories = $this->findAssociationCategories()->getCategories(); $categories->rewind(); while ($categories->valid()) { $category = $categories->current(); if ($category->getID() == $id) { return $category; } $categories->next(); } }
php
public function findAssociationCategoryByID($id) { $categories = $this->findAssociationCategories()->getCategories(); $categories->rewind(); while ($categories->valid()) { $category = $categories->current(); if ($category->getID() == $id) { return $category; } $categories->next(); } }
[ "public", "function", "findAssociationCategoryByID", "(", "$", "id", ")", "{", "$", "categories", "=", "$", "this", "->", "findAssociationCategories", "(", ")", "->", "getCategories", "(", ")", ";", "$", "categories", "->", "rewind", "(", ")", ";", "while", "(", "$", "categories", "->", "valid", "(", ")", ")", "{", "$", "category", "=", "$", "categories", "->", "current", "(", ")", ";", "if", "(", "$", "category", "->", "getID", "(", ")", "==", "$", "id", ")", "{", "return", "$", "category", ";", "}", "$", "categories", "->", "next", "(", ")", ";", "}", "}" ]
return a association category @param string category id @return Category
[ "return", "a", "association", "category" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L30-L44
10,079
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationCategories
public function findAssociationCategories() { $xmlQuery = $this->metaApiService->getAssociationCategories(); $categories = new Categories(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationCategories($xmlQuery); $mapper->mapToAbstractEntity($categories); return $categories; }
php
public function findAssociationCategories() { $xmlQuery = $this->metaApiService->getAssociationCategories(); $categories = new Categories(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationCategories($xmlQuery); $mapper->mapToAbstractEntity($categories); return $categories; }
[ "public", "function", "findAssociationCategories", "(", ")", "{", "$", "xmlQuery", "=", "$", "this", "->", "metaApiService", "->", "getAssociationCategories", "(", ")", ";", "$", "categories", "=", "new", "Categories", "(", ")", ";", "$", "mapper", "=", "new", "\\", "RGU", "\\", "Dvoconnector", "\\", "Mapper", "\\", "AssociationCategories", "(", "$", "xmlQuery", ")", ";", "$", "mapper", "->", "mapToAbstractEntity", "(", "$", "categories", ")", ";", "return", "$", "categories", ";", "}" ]
return all association categories @return Categories
[ "return", "all", "association", "categories" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L52-L62
10,080
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationRepertoireByID
public function findAssociationRepertoireByID($id) { $repertoires = $this->findAssociationRepertoires()->getRepertoires(); $repertoires->rewind(); while ($repertoires->valid()) { $repertoire = $repertoires->current(); if ($repertoire->getID() == $id) { return $repertoire; } $repertoires->next(); } }
php
public function findAssociationRepertoireByID($id) { $repertoires = $this->findAssociationRepertoires()->getRepertoires(); $repertoires->rewind(); while ($repertoires->valid()) { $repertoire = $repertoires->current(); if ($repertoire->getID() == $id) { return $repertoire; } $repertoires->next(); } }
[ "public", "function", "findAssociationRepertoireByID", "(", "$", "id", ")", "{", "$", "repertoires", "=", "$", "this", "->", "findAssociationRepertoires", "(", ")", "->", "getRepertoires", "(", ")", ";", "$", "repertoires", "->", "rewind", "(", ")", ";", "while", "(", "$", "repertoires", "->", "valid", "(", ")", ")", "{", "$", "repertoire", "=", "$", "repertoires", "->", "current", "(", ")", ";", "if", "(", "$", "repertoire", "->", "getID", "(", ")", "==", "$", "id", ")", "{", "return", "$", "repertoire", ";", "}", "$", "repertoires", "->", "next", "(", ")", ";", "}", "}" ]
return a association repertoire @param string repertoire id @return Repertoire
[ "return", "a", "association", "repertoire" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L71-L85
10,081
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationRepertoires
public function findAssociationRepertoires() { $xmlQuery = $this->metaApiService->getAssociationRepertoires(); $repertoires = new Repertoires(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationRepertoires($xmlQuery); $mapper->mapToAbstractEntity($repertoires); return $repertoires; }
php
public function findAssociationRepertoires() { $xmlQuery = $this->metaApiService->getAssociationRepertoires(); $repertoires = new Repertoires(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationRepertoires($xmlQuery); $mapper->mapToAbstractEntity($repertoires); return $repertoires; }
[ "public", "function", "findAssociationRepertoires", "(", ")", "{", "$", "xmlQuery", "=", "$", "this", "->", "metaApiService", "->", "getAssociationRepertoires", "(", ")", ";", "$", "repertoires", "=", "new", "Repertoires", "(", ")", ";", "$", "mapper", "=", "new", "\\", "RGU", "\\", "Dvoconnector", "\\", "Mapper", "\\", "AssociationRepertoires", "(", "$", "xmlQuery", ")", ";", "$", "mapper", "->", "mapToAbstractEntity", "(", "$", "repertoires", ")", ";", "return", "$", "repertoires", ";", "}" ]
return all association repertoires @return Repertoires
[ "return", "all", "association", "repertoires" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L93-L103
10,082
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationPerformancelevelByID
public function findAssociationPerformancelevelByID($id) { $performancelevels = $this->findAssociationPerformancelevels()->getPerformancelevels(); $performancelevels->rewind(); while ($performancelevels->valid()) { $performancelevel = $performancelevels->current(); if ($performancelevel->getID() == $id) { return $performancelevel; } $performancelevels->next(); } }
php
public function findAssociationPerformancelevelByID($id) { $performancelevels = $this->findAssociationPerformancelevels()->getPerformancelevels(); $performancelevels->rewind(); while ($performancelevels->valid()) { $performancelevel = $performancelevels->current(); if ($performancelevel->getID() == $id) { return $performancelevel; } $performancelevels->next(); } }
[ "public", "function", "findAssociationPerformancelevelByID", "(", "$", "id", ")", "{", "$", "performancelevels", "=", "$", "this", "->", "findAssociationPerformancelevels", "(", ")", "->", "getPerformancelevels", "(", ")", ";", "$", "performancelevels", "->", "rewind", "(", ")", ";", "while", "(", "$", "performancelevels", "->", "valid", "(", ")", ")", "{", "$", "performancelevel", "=", "$", "performancelevels", "->", "current", "(", ")", ";", "if", "(", "$", "performancelevel", "->", "getID", "(", ")", "==", "$", "id", ")", "{", "return", "$", "performancelevel", ";", "}", "$", "performancelevels", "->", "next", "(", ")", ";", "}", "}" ]
return a association performancelevel @param string performancelevel id @return Performancelevel
[ "return", "a", "association", "performancelevel" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L112-L126
10,083
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findAssociationPerformancelevels
public function findAssociationPerformancelevels() { $xmlQuery = $this->metaApiService->getAssociationPerformancelevels(); $performancelevels = new Performancelevels(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationPerformancelevels($xmlQuery); $mapper->mapToAbstractEntity($performancelevels); return $performancelevels; }
php
public function findAssociationPerformancelevels() { $xmlQuery = $this->metaApiService->getAssociationPerformancelevels(); $performancelevels = new Performancelevels(); $mapper = new \RGU\Dvoconnector\Mapper\AssociationPerformancelevels($xmlQuery); $mapper->mapToAbstractEntity($performancelevels); return $performancelevels; }
[ "public", "function", "findAssociationPerformancelevels", "(", ")", "{", "$", "xmlQuery", "=", "$", "this", "->", "metaApiService", "->", "getAssociationPerformancelevels", "(", ")", ";", "$", "performancelevels", "=", "new", "Performancelevels", "(", ")", ";", "$", "mapper", "=", "new", "\\", "RGU", "\\", "Dvoconnector", "\\", "Mapper", "\\", "AssociationPerformancelevels", "(", "$", "xmlQuery", ")", ";", "$", "mapper", "->", "mapToAbstractEntity", "(", "$", "performancelevels", ")", ";", "return", "$", "performancelevels", ";", "}" ]
return all association performancelevels @return Performancelevels
[ "return", "all", "association", "performancelevels" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L134-L144
10,084
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findEventTypeByID
public function findEventTypeByID($id) { $eventTypes = $this->findEventTypes()->getTypes(); $eventTypes->rewind(); while ($eventTypes->valid()) { $eventType = $eventTypes->current(); if ($eventType->getID() == $id) { return $eventType; } $eventTypes->next(); } }
php
public function findEventTypeByID($id) { $eventTypes = $this->findEventTypes()->getTypes(); $eventTypes->rewind(); while ($eventTypes->valid()) { $eventType = $eventTypes->current(); if ($eventType->getID() == $id) { return $eventType; } $eventTypes->next(); } }
[ "public", "function", "findEventTypeByID", "(", "$", "id", ")", "{", "$", "eventTypes", "=", "$", "this", "->", "findEventTypes", "(", ")", "->", "getTypes", "(", ")", ";", "$", "eventTypes", "->", "rewind", "(", ")", ";", "while", "(", "$", "eventTypes", "->", "valid", "(", ")", ")", "{", "$", "eventType", "=", "$", "eventTypes", "->", "current", "(", ")", ";", "if", "(", "$", "eventType", "->", "getID", "(", ")", "==", "$", "id", ")", "{", "return", "$", "eventType", ";", "}", "$", "eventTypes", "->", "next", "(", ")", ";", "}", "}" ]
return a event type @param string event type id @return Event
[ "return", "a", "event", "type" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L153-L167
10,085
codebobbly/dvoconnector
Classes/Domain/Repository/MetaRepository.php
MetaRepository.findEventTypes
public function findEventTypes() { $xmlQuery = $this->metaApiService->getEventTypes(); $types = new Types(); $mapper = new \RGU\Dvoconnector\Mapper\EventTypes($xmlQuery); $mapper->mapToAbstractEntity($types); return $types; }
php
public function findEventTypes() { $xmlQuery = $this->metaApiService->getEventTypes(); $types = new Types(); $mapper = new \RGU\Dvoconnector\Mapper\EventTypes($xmlQuery); $mapper->mapToAbstractEntity($types); return $types; }
[ "public", "function", "findEventTypes", "(", ")", "{", "$", "xmlQuery", "=", "$", "this", "->", "metaApiService", "->", "getEventTypes", "(", ")", ";", "$", "types", "=", "new", "Types", "(", ")", ";", "$", "mapper", "=", "new", "\\", "RGU", "\\", "Dvoconnector", "\\", "Mapper", "\\", "EventTypes", "(", "$", "xmlQuery", ")", ";", "$", "mapper", "->", "mapToAbstractEntity", "(", "$", "types", ")", ";", "return", "$", "types", ";", "}" ]
return all event types @return Events
[ "return", "all", "event", "types" ]
9b63790d2fc9fd21bf415b4a5757678895b73bbc
https://github.com/codebobbly/dvoconnector/blob/9b63790d2fc9fd21bf415b4a5757678895b73bbc/Classes/Domain/Repository/MetaRepository.php#L175-L185
10,086
laradic/service-provider
src/_ServiceProvider.php
_ServiceProvider.defaultConfigStrategy
protected function defaultConfigStrategy($path, $key) { $config = $this->app->make('config')->get($key, []); $this->app->make('config')->set($key, array_replace_recursive(require $path, $config)); }
php
protected function defaultConfigStrategy($path, $key) { $config = $this->app->make('config')->get($key, []); $this->app->make('config')->set($key, array_replace_recursive(require $path, $config)); }
[ "protected", "function", "defaultConfigStrategy", "(", "$", "path", ",", "$", "key", ")", "{", "$", "config", "=", "$", "this", "->", "app", "->", "make", "(", "'config'", ")", "->", "get", "(", "$", "key", ",", "[", "]", ")", ";", "$", "this", "->", "app", "->", "make", "(", "'config'", ")", "->", "set", "(", "$", "key", ",", "array_replace_recursive", "(", "require", "$", "path", ",", "$", "config", ")", ")", ";", "}" ]
The default config merge function, instead of using the laravel mergeConfigRom it. @param $path @param $key
[ "The", "default", "config", "merge", "function", "instead", "of", "using", "the", "laravel", "mergeConfigRom", "it", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/_ServiceProvider.php#L605-L609
10,087
laradic/service-provider
src/_ServiceProvider.php
_ServiceProvider.tryRegisterProviders
protected function tryRegisterProviders($on) { if ($on === $this->registerProvidersOn && $this->registerProvidersMethod === self::METHOD_REGISTER) { // FIRST register all given providers foreach ($this->providers as $provider) { $this->app->register($provider); } foreach ($this->deferredProviders as $provider) { $this->app->registerDeferredProvider($provider); } } elseif ($this->registerProvidersMethod === self::METHOD_RESOLVE) { foreach ($this->providers as $provider) { $resolved = $this->app->resolveProviderClass($registered[] = $provider); if ($on === self::ON_REGISTER) { $resolved->register(); } elseif ($on === self::ON_BOOT) { $this->app->call([$provider, 'boot']); } } } }
php
protected function tryRegisterProviders($on) { if ($on === $this->registerProvidersOn && $this->registerProvidersMethod === self::METHOD_REGISTER) { // FIRST register all given providers foreach ($this->providers as $provider) { $this->app->register($provider); } foreach ($this->deferredProviders as $provider) { $this->app->registerDeferredProvider($provider); } } elseif ($this->registerProvidersMethod === self::METHOD_RESOLVE) { foreach ($this->providers as $provider) { $resolved = $this->app->resolveProviderClass($registered[] = $provider); if ($on === self::ON_REGISTER) { $resolved->register(); } elseif ($on === self::ON_BOOT) { $this->app->call([$provider, 'boot']); } } } }
[ "protected", "function", "tryRegisterProviders", "(", "$", "on", ")", "{", "if", "(", "$", "on", "===", "$", "this", "->", "registerProvidersOn", "&&", "$", "this", "->", "registerProvidersMethod", "===", "self", "::", "METHOD_REGISTER", ")", "{", "// FIRST register all given providers", "foreach", "(", "$", "this", "->", "providers", "as", "$", "provider", ")", "{", "$", "this", "->", "app", "->", "register", "(", "$", "provider", ")", ";", "}", "foreach", "(", "$", "this", "->", "deferredProviders", "as", "$", "provider", ")", "{", "$", "this", "->", "app", "->", "registerDeferredProvider", "(", "$", "provider", ")", ";", "}", "}", "elseif", "(", "$", "this", "->", "registerProvidersMethod", "===", "self", "::", "METHOD_RESOLVE", ")", "{", "foreach", "(", "$", "this", "->", "providers", "as", "$", "provider", ")", "{", "$", "resolved", "=", "$", "this", "->", "app", "->", "resolveProviderClass", "(", "$", "registered", "[", "]", "=", "$", "provider", ")", ";", "if", "(", "$", "on", "===", "self", "::", "ON_REGISTER", ")", "{", "$", "resolved", "->", "register", "(", ")", ";", "}", "elseif", "(", "$", "on", "===", "self", "::", "ON_BOOT", ")", "{", "$", "this", "->", "app", "->", "call", "(", "[", "$", "provider", ",", "'boot'", "]", ")", ";", "}", "}", "}", "}" ]
tryRegisterProviders method. @param $on
[ "tryRegisterProviders", "method", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/_ServiceProvider.php#L650-L671
10,088
laradic/service-provider
src/_ServiceProvider.php
_ServiceProvider.routeMiddleware
protected function routeMiddleware($key, $middleware = null, $force = false) { if ($this->app->runningInConsole() && $force === false) { return $this->getRouter(); } if (is_array($key)) { foreach ($key as $k => $m) { $this->routeMiddleware($k, $m); } return $this->getRouter(); } else { $this->getRouter()->middleware($key, $middleware); } }
php
protected function routeMiddleware($key, $middleware = null, $force = false) { if ($this->app->runningInConsole() && $force === false) { return $this->getRouter(); } if (is_array($key)) { foreach ($key as $k => $m) { $this->routeMiddleware($k, $m); } return $this->getRouter(); } else { $this->getRouter()->middleware($key, $middleware); } }
[ "protected", "function", "routeMiddleware", "(", "$", "key", ",", "$", "middleware", "=", "null", ",", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "app", "->", "runningInConsole", "(", ")", "&&", "$", "force", "===", "false", ")", "{", "return", "$", "this", "->", "getRouter", "(", ")", ";", "}", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "k", "=>", "$", "m", ")", "{", "$", "this", "->", "routeMiddleware", "(", "$", "k", ",", "$", "m", ")", ";", "}", "return", "$", "this", "->", "getRouter", "(", ")", ";", "}", "else", "{", "$", "this", "->", "getRouter", "(", ")", "->", "middleware", "(", "$", "key", ",", "$", "middleware", ")", ";", "}", "}" ]
Add a route middleware. Will not be added when running in console. @param $key @param null $middleware @param bool $force @return \Illuminate\Contracts\Routing\Registrar|\Illuminate\Routing\Router
[ "Add", "a", "route", "middleware", ".", "Will", "not", "be", "added", "when", "running", "in", "console", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/_ServiceProvider.php#L770-L784
10,089
laradic/service-provider
src/_ServiceProvider.php
_ServiceProvider.getResolvedPaths
protected function getResolvedPaths() { if (null === $this->resolvedPaths) { $this->resolveDirectories(); // Collect all path properties and put them into $paths associatively using propertyName => propertyValue $paths = []; collect(array_keys(get_class_vars(get_class($this))))->filter(function ($propertyName) { return ends_with($propertyName, 'Path'); })->each(function ($propertyName) use (&$paths) { $paths[ $propertyName ] = $this->{$propertyName}; }); // Use the paths to generate parsed paths, resolving all the {vars} $this->resolvedPaths = collect($paths)->transform(function ($path) use ($paths) { return Util::template($path, $paths); })->transform(function ($path, $propertyName) { return ends_with($propertyName, 'DestinationPath') ? base_path($path) : path_join($this->rootDir, $path); })->toArray(); } return $this->resolvedPaths; }
php
protected function getResolvedPaths() { if (null === $this->resolvedPaths) { $this->resolveDirectories(); // Collect all path properties and put them into $paths associatively using propertyName => propertyValue $paths = []; collect(array_keys(get_class_vars(get_class($this))))->filter(function ($propertyName) { return ends_with($propertyName, 'Path'); })->each(function ($propertyName) use (&$paths) { $paths[ $propertyName ] = $this->{$propertyName}; }); // Use the paths to generate parsed paths, resolving all the {vars} $this->resolvedPaths = collect($paths)->transform(function ($path) use ($paths) { return Util::template($path, $paths); })->transform(function ($path, $propertyName) { return ends_with($propertyName, 'DestinationPath') ? base_path($path) : path_join($this->rootDir, $path); })->toArray(); } return $this->resolvedPaths; }
[ "protected", "function", "getResolvedPaths", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "resolvedPaths", ")", "{", "$", "this", "->", "resolveDirectories", "(", ")", ";", "// Collect all path properties and put them into $paths associatively using propertyName => propertyValue", "$", "paths", "=", "[", "]", ";", "collect", "(", "array_keys", "(", "get_class_vars", "(", "get_class", "(", "$", "this", ")", ")", ")", ")", "->", "filter", "(", "function", "(", "$", "propertyName", ")", "{", "return", "ends_with", "(", "$", "propertyName", ",", "'Path'", ")", ";", "}", ")", "->", "each", "(", "function", "(", "$", "propertyName", ")", "use", "(", "&", "$", "paths", ")", "{", "$", "paths", "[", "$", "propertyName", "]", "=", "$", "this", "->", "{", "$", "propertyName", "}", ";", "}", ")", ";", "// Use the paths to generate parsed paths, resolving all the {vars}", "$", "this", "->", "resolvedPaths", "=", "collect", "(", "$", "paths", ")", "->", "transform", "(", "function", "(", "$", "path", ")", "use", "(", "$", "paths", ")", "{", "return", "Util", "::", "template", "(", "$", "path", ",", "$", "paths", ")", ";", "}", ")", "->", "transform", "(", "function", "(", "$", "path", ",", "$", "propertyName", ")", "{", "return", "ends_with", "(", "$", "propertyName", ",", "'DestinationPath'", ")", "?", "base_path", "(", "$", "path", ")", ":", "path_join", "(", "$", "this", "->", "rootDir", ",", "$", "path", ")", ";", "}", ")", "->", "toArray", "(", ")", ";", "}", "return", "$", "this", "->", "resolvedPaths", ";", "}" ]
resolvePaths method. @todo @return array
[ "resolvePaths", "method", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/_ServiceProvider.php#L883-L904
10,090
laradic/service-provider
src/_ServiceProvider.php
_ServiceProvider.findCommandsFiles
protected function findCommandsFiles($directory) { $glob = glob($directory.'/*'); if ($glob === false) { return []; } // To get the appropriate files, we'll simply glob the directory and filter // out any "files" that are not truly files so we do not end up with any // directories in our list, but only true files within the directory. return array_filter($glob, function ($file) { return filetype($file) == 'file'; }); }
php
protected function findCommandsFiles($directory) { $glob = glob($directory.'/*'); if ($glob === false) { return []; } // To get the appropriate files, we'll simply glob the directory and filter // out any "files" that are not truly files so we do not end up with any // directories in our list, but only true files within the directory. return array_filter($glob, function ($file) { return filetype($file) == 'file'; }); }
[ "protected", "function", "findCommandsFiles", "(", "$", "directory", ")", "{", "$", "glob", "=", "glob", "(", "$", "directory", ".", "'/*'", ")", ";", "if", "(", "$", "glob", "===", "false", ")", "{", "return", "[", "]", ";", "}", "// To get the appropriate files, we'll simply glob the directory and filter", "// out any \"files\" that are not truly files so we do not end up with any", "// directories in our list, but only true files within the directory.", "return", "array_filter", "(", "$", "glob", ",", "function", "(", "$", "file", ")", "{", "return", "filetype", "(", "$", "file", ")", "==", "'file'", ";", "}", ")", ";", "}" ]
findCommandsFiles method. @param $directory @return array
[ "findCommandsFiles", "method", "." ]
b1428d566b97b3662b405c64ff0cad8a89102033
https://github.com/laradic/service-provider/blob/b1428d566b97b3662b405c64ff0cad8a89102033/src/_ServiceProvider.php#L955-L969
10,091
onesimus-systems/oslogger
src/Adaptors/AbstractAdaptor.php
AbstractAdaptor.isHandling
public function isHandling($level) { $min = $this->minimumLevel; $max = $this->maximumLevel; $lev = Logger::$levels[$level]; return ($min >= $lev && $lev >= $max); }
php
public function isHandling($level) { $min = $this->minimumLevel; $max = $this->maximumLevel; $lev = Logger::$levels[$level]; return ($min >= $lev && $lev >= $max); }
[ "public", "function", "isHandling", "(", "$", "level", ")", "{", "$", "min", "=", "$", "this", "->", "minimumLevel", ";", "$", "max", "=", "$", "this", "->", "maximumLevel", ";", "$", "lev", "=", "Logger", "::", "$", "levels", "[", "$", "level", "]", ";", "return", "(", "$", "min", ">=", "$", "lev", "&&", "$", "lev", ">=", "$", "max", ")", ";", "}" ]
Checks if the log level is handled with this adaptor @param string $level Log level @return boolean
[ "Checks", "if", "the", "log", "level", "is", "handled", "with", "this", "adaptor" ]
98138d4fbcae83b9cedac13ab173a3f8273de3e0
https://github.com/onesimus-systems/oslogger/blob/98138d4fbcae83b9cedac13ab173a3f8273de3e0/src/Adaptors/AbstractAdaptor.php#L41-L48
10,092
onesimus-systems/oslogger
src/Adaptors/AbstractAdaptor.php
AbstractAdaptor.setLevel
public function setLevel($min = null, $max = null) { // Null for default allows easier calling to set // a maximum level only if (!$min || !Logger::isLogLevel($min)) { $min = LogLevel::DEBUG; } if (!$max || !Logger::isLogLevel($max)) { $max = LogLevel::EMERGENCY; } $this->minimumLevel = Logger::$levels[$min]; $this->maximumLevel = Logger::$levels[$max]; }
php
public function setLevel($min = null, $max = null) { // Null for default allows easier calling to set // a maximum level only if (!$min || !Logger::isLogLevel($min)) { $min = LogLevel::DEBUG; } if (!$max || !Logger::isLogLevel($max)) { $max = LogLevel::EMERGENCY; } $this->minimumLevel = Logger::$levels[$min]; $this->maximumLevel = Logger::$levels[$max]; }
[ "public", "function", "setLevel", "(", "$", "min", "=", "null", ",", "$", "max", "=", "null", ")", "{", "// Null for default allows easier calling to set", "// a maximum level only", "if", "(", "!", "$", "min", "||", "!", "Logger", "::", "isLogLevel", "(", "$", "min", ")", ")", "{", "$", "min", "=", "LogLevel", "::", "DEBUG", ";", "}", "if", "(", "!", "$", "max", "||", "!", "Logger", "::", "isLogLevel", "(", "$", "max", ")", ")", "{", "$", "max", "=", "LogLevel", "::", "EMERGENCY", ";", "}", "$", "this", "->", "minimumLevel", "=", "Logger", "::", "$", "levels", "[", "$", "min", "]", ";", "$", "this", "->", "maximumLevel", "=", "Logger", "::", "$", "levels", "[", "$", "max", "]", ";", "}" ]
Sets the minimum log level handled by this adaptor @param string $level Log level
[ "Sets", "the", "minimum", "log", "level", "handled", "by", "this", "adaptor" ]
98138d4fbcae83b9cedac13ab173a3f8273de3e0
https://github.com/onesimus-systems/oslogger/blob/98138d4fbcae83b9cedac13ab173a3f8273de3e0/src/Adaptors/AbstractAdaptor.php#L55-L69
10,093
flowcode/ceibo
src/flowcode/ceibo/EntityManager.php
EntityManager.findRelation
public function findRelation($entity, $relationName, $orderColumn = null, $orderType = null) { $this->load(); $mapper = MapperBuilder::buildFromClassName($this->mapping, get_class($entity)); $relation = $mapper->getRelation($relationName); $relationMapper = MapperBuilder::buildFromName($this->mapping, $relation->getEntity()); $selectQuery = "SELECT tmain.* FROM `" . $relationMapper->getTable() . "` tmain "; $joinQuery = QueryBuilder::buildJoinRelationQuery($relation, "tmain", "j1"); $whereQuery = "WHERE j1." . $relation->getLocalColumn() . " = '" . $entity->getId() . "'"; $orderQuery = ""; if (!is_null($orderColumn)) { $orderQuery .= "ORDER BY $orderColumn "; if (!is_null($orderType)) { $orderQuery .= "$orderType"; } else { $orderQuery .= "ASC"; } } $query = $selectQuery . $joinQuery . $whereQuery . $orderQuery; $queryResult = $this->getDataSource()->query($query); if ($queryResult) { $collection = new Collection($relationMapper->getClass(), $queryResult, $relationMapper); } else { $collection = new Collection($relationMapper->getClass(), array(), $relationMapper); } return $collection; }
php
public function findRelation($entity, $relationName, $orderColumn = null, $orderType = null) { $this->load(); $mapper = MapperBuilder::buildFromClassName($this->mapping, get_class($entity)); $relation = $mapper->getRelation($relationName); $relationMapper = MapperBuilder::buildFromName($this->mapping, $relation->getEntity()); $selectQuery = "SELECT tmain.* FROM `" . $relationMapper->getTable() . "` tmain "; $joinQuery = QueryBuilder::buildJoinRelationQuery($relation, "tmain", "j1"); $whereQuery = "WHERE j1." . $relation->getLocalColumn() . " = '" . $entity->getId() . "'"; $orderQuery = ""; if (!is_null($orderColumn)) { $orderQuery .= "ORDER BY $orderColumn "; if (!is_null($orderType)) { $orderQuery .= "$orderType"; } else { $orderQuery .= "ASC"; } } $query = $selectQuery . $joinQuery . $whereQuery . $orderQuery; $queryResult = $this->getDataSource()->query($query); if ($queryResult) { $collection = new Collection($relationMapper->getClass(), $queryResult, $relationMapper); } else { $collection = new Collection($relationMapper->getClass(), array(), $relationMapper); } return $collection; }
[ "public", "function", "findRelation", "(", "$", "entity", ",", "$", "relationName", ",", "$", "orderColumn", "=", "null", ",", "$", "orderType", "=", "null", ")", "{", "$", "this", "->", "load", "(", ")", ";", "$", "mapper", "=", "MapperBuilder", "::", "buildFromClassName", "(", "$", "this", "->", "mapping", ",", "get_class", "(", "$", "entity", ")", ")", ";", "$", "relation", "=", "$", "mapper", "->", "getRelation", "(", "$", "relationName", ")", ";", "$", "relationMapper", "=", "MapperBuilder", "::", "buildFromName", "(", "$", "this", "->", "mapping", ",", "$", "relation", "->", "getEntity", "(", ")", ")", ";", "$", "selectQuery", "=", "\"SELECT tmain.* FROM `\"", ".", "$", "relationMapper", "->", "getTable", "(", ")", ".", "\"` tmain \"", ";", "$", "joinQuery", "=", "QueryBuilder", "::", "buildJoinRelationQuery", "(", "$", "relation", ",", "\"tmain\"", ",", "\"j1\"", ")", ";", "$", "whereQuery", "=", "\"WHERE j1.\"", ".", "$", "relation", "->", "getLocalColumn", "(", ")", ".", "\" = '\"", ".", "$", "entity", "->", "getId", "(", ")", ".", "\"'\"", ";", "$", "orderQuery", "=", "\"\"", ";", "if", "(", "!", "is_null", "(", "$", "orderColumn", ")", ")", "{", "$", "orderQuery", ".=", "\"ORDER BY $orderColumn \"", ";", "if", "(", "!", "is_null", "(", "$", "orderType", ")", ")", "{", "$", "orderQuery", ".=", "\"$orderType\"", ";", "}", "else", "{", "$", "orderQuery", ".=", "\"ASC\"", ";", "}", "}", "$", "query", "=", "$", "selectQuery", ".", "$", "joinQuery", ".", "$", "whereQuery", ".", "$", "orderQuery", ";", "$", "queryResult", "=", "$", "this", "->", "getDataSource", "(", ")", "->", "query", "(", "$", "query", ")", ";", "if", "(", "$", "queryResult", ")", "{", "$", "collection", "=", "new", "Collection", "(", "$", "relationMapper", "->", "getClass", "(", ")", ",", "$", "queryResult", ",", "$", "relationMapper", ")", ";", "}", "else", "{", "$", "collection", "=", "new", "Collection", "(", "$", "relationMapper", "->", "getClass", "(", ")", ",", "array", "(", ")", ",", "$", "relationMapper", ")", ";", "}", "return", "$", "collection", ";", "}" ]
Find by table relation. @param type $entity @param string $relationName @param string $orderColumn @param string $orderType @return Collection
[ "Find", "by", "table", "relation", "." ]
ba264dc681a9d803885fd35d10b0e37776f66659
https://github.com/flowcode/ceibo/blob/ba264dc681a9d803885fd35d10b0e37776f66659/src/flowcode/ceibo/EntityManager.php#L329-L358
10,094
flowcode/ceibo
src/flowcode/ceibo/EntityManager.php
EntityManager.findByGenericFilter
public function findByGenericFilter($name, $filter = null, $page = 1, $orderColumn = null, $orderType = null) { $this->load(); $mapper = MapperBuilder::buildFromName($this->mapping, $name); $selectQuery = ""; $whereQuery = ""; $orderQuery = ""; $selectQuery .= "SELECT * FROM `" . $mapper->getTable() . "` "; $filterList = array(); if (!is_null($filter)) { $filterList = explode(" ", $filter); } if (!is_null($filter)) { $whereQuery .= " WHERE 1=2 "; foreach ($filterList as $searchedWord) { foreach ($mapper->getFilter("generic")->getColumns() as $filteredColumn) { $whereQuery .= " OR $filteredColumn LIKE '%" . $searchedWord . "%'"; } } } else { $whereQuery .= " WHERE 1 "; } if (!is_null($orderColumn)) { $orderQuery .= "ORDER BY $orderColumn "; if (!is_null($orderType)) { $orderQuery .= "$orderType"; } else { $orderQuery .= "ASC"; } } $from = ($page - 1) * $mapper->getFilter("generic")->getItemsPerPage(); $pageQuery = " LIMIT $from , " . $mapper->getFilter("generic")->getItemsPerPage(); $query = $selectQuery . $whereQuery . $orderQuery . $pageQuery; $result = $this->getDataSource()->query($query); if ($result) { $collection = new Collection($mapper->getClass(), $result, $mapper); } else { $collection = new Collection($mapper->getClass(), array(), $mapper); } $selectCountQuery = "SELECT count(*) as total FROM `" . $mapper->getTable() . "` "; $query = $selectCountQuery . $whereQuery; $result = $this->getDataSource()->query($query); $itemCount = $result[0]["total"]; $pager = new Pager($collection, $itemCount, $mapper->getFilter("generic")->getItemsPerPage(), $page); return $pager; }
php
public function findByGenericFilter($name, $filter = null, $page = 1, $orderColumn = null, $orderType = null) { $this->load(); $mapper = MapperBuilder::buildFromName($this->mapping, $name); $selectQuery = ""; $whereQuery = ""; $orderQuery = ""; $selectQuery .= "SELECT * FROM `" . $mapper->getTable() . "` "; $filterList = array(); if (!is_null($filter)) { $filterList = explode(" ", $filter); } if (!is_null($filter)) { $whereQuery .= " WHERE 1=2 "; foreach ($filterList as $searchedWord) { foreach ($mapper->getFilter("generic")->getColumns() as $filteredColumn) { $whereQuery .= " OR $filteredColumn LIKE '%" . $searchedWord . "%'"; } } } else { $whereQuery .= " WHERE 1 "; } if (!is_null($orderColumn)) { $orderQuery .= "ORDER BY $orderColumn "; if (!is_null($orderType)) { $orderQuery .= "$orderType"; } else { $orderQuery .= "ASC"; } } $from = ($page - 1) * $mapper->getFilter("generic")->getItemsPerPage(); $pageQuery = " LIMIT $from , " . $mapper->getFilter("generic")->getItemsPerPage(); $query = $selectQuery . $whereQuery . $orderQuery . $pageQuery; $result = $this->getDataSource()->query($query); if ($result) { $collection = new Collection($mapper->getClass(), $result, $mapper); } else { $collection = new Collection($mapper->getClass(), array(), $mapper); } $selectCountQuery = "SELECT count(*) as total FROM `" . $mapper->getTable() . "` "; $query = $selectCountQuery . $whereQuery; $result = $this->getDataSource()->query($query); $itemCount = $result[0]["total"]; $pager = new Pager($collection, $itemCount, $mapper->getFilter("generic")->getItemsPerPage(), $page); return $pager; }
[ "public", "function", "findByGenericFilter", "(", "$", "name", ",", "$", "filter", "=", "null", ",", "$", "page", "=", "1", ",", "$", "orderColumn", "=", "null", ",", "$", "orderType", "=", "null", ")", "{", "$", "this", "->", "load", "(", ")", ";", "$", "mapper", "=", "MapperBuilder", "::", "buildFromName", "(", "$", "this", "->", "mapping", ",", "$", "name", ")", ";", "$", "selectQuery", "=", "\"\"", ";", "$", "whereQuery", "=", "\"\"", ";", "$", "orderQuery", "=", "\"\"", ";", "$", "selectQuery", ".=", "\"SELECT * FROM `\"", ".", "$", "mapper", "->", "getTable", "(", ")", ".", "\"` \"", ";", "$", "filterList", "=", "array", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "filter", ")", ")", "{", "$", "filterList", "=", "explode", "(", "\" \"", ",", "$", "filter", ")", ";", "}", "if", "(", "!", "is_null", "(", "$", "filter", ")", ")", "{", "$", "whereQuery", ".=", "\" WHERE 1=2 \"", ";", "foreach", "(", "$", "filterList", "as", "$", "searchedWord", ")", "{", "foreach", "(", "$", "mapper", "->", "getFilter", "(", "\"generic\"", ")", "->", "getColumns", "(", ")", "as", "$", "filteredColumn", ")", "{", "$", "whereQuery", ".=", "\" OR $filteredColumn LIKE '%\"", ".", "$", "searchedWord", ".", "\"%'\"", ";", "}", "}", "}", "else", "{", "$", "whereQuery", ".=", "\" WHERE 1 \"", ";", "}", "if", "(", "!", "is_null", "(", "$", "orderColumn", ")", ")", "{", "$", "orderQuery", ".=", "\"ORDER BY $orderColumn \"", ";", "if", "(", "!", "is_null", "(", "$", "orderType", ")", ")", "{", "$", "orderQuery", ".=", "\"$orderType\"", ";", "}", "else", "{", "$", "orderQuery", ".=", "\"ASC\"", ";", "}", "}", "$", "from", "=", "(", "$", "page", "-", "1", ")", "*", "$", "mapper", "->", "getFilter", "(", "\"generic\"", ")", "->", "getItemsPerPage", "(", ")", ";", "$", "pageQuery", "=", "\" LIMIT $from , \"", ".", "$", "mapper", "->", "getFilter", "(", "\"generic\"", ")", "->", "getItemsPerPage", "(", ")", ";", "$", "query", "=", "$", "selectQuery", ".", "$", "whereQuery", ".", "$", "orderQuery", ".", "$", "pageQuery", ";", "$", "result", "=", "$", "this", "->", "getDataSource", "(", ")", "->", "query", "(", "$", "query", ")", ";", "if", "(", "$", "result", ")", "{", "$", "collection", "=", "new", "Collection", "(", "$", "mapper", "->", "getClass", "(", ")", ",", "$", "result", ",", "$", "mapper", ")", ";", "}", "else", "{", "$", "collection", "=", "new", "Collection", "(", "$", "mapper", "->", "getClass", "(", ")", ",", "array", "(", ")", ",", "$", "mapper", ")", ";", "}", "$", "selectCountQuery", "=", "\"SELECT count(*) as total FROM `\"", ".", "$", "mapper", "->", "getTable", "(", ")", ".", "\"` \"", ";", "$", "query", "=", "$", "selectCountQuery", ".", "$", "whereQuery", ";", "$", "result", "=", "$", "this", "->", "getDataSource", "(", ")", "->", "query", "(", "$", "query", ")", ";", "$", "itemCount", "=", "$", "result", "[", "0", "]", "[", "\"total\"", "]", ";", "$", "pager", "=", "new", "Pager", "(", "$", "collection", ",", "$", "itemCount", ",", "$", "mapper", "->", "getFilter", "(", "\"generic\"", ")", "->", "getItemsPerPage", "(", ")", ",", "$", "page", ")", ";", "return", "$", "pager", ";", "}" ]
Finds entitys by its generic filter defined in the configured mapping. @param type $name @param type $filter @param type $page @param type $orderColumn @param type $orderType @return Pager
[ "Finds", "entitys", "by", "its", "generic", "filter", "defined", "in", "the", "configured", "mapping", "." ]
ba264dc681a9d803885fd35d10b0e37776f66659
https://github.com/flowcode/ceibo/blob/ba264dc681a9d803885fd35d10b0e37776f66659/src/flowcode/ceibo/EntityManager.php#L419-L472
10,095
blast-project/ResourceBundle
src/Doctrine/ORM/NamingStrategy/UnderscoredBundlePrefixStrategy.php
UnderscoredBundlePrefixStrategy.getTableNamePrefix
private function getTableNamePrefix($className) { $name = ltrim($className, '\\'); foreach ($this->namingMap as $prefix => $namespace) { if (strpos($name, $namespace) === 0) { return $prefix . '_'; } } return ''; }
php
private function getTableNamePrefix($className) { $name = ltrim($className, '\\'); foreach ($this->namingMap as $prefix => $namespace) { if (strpos($name, $namespace) === 0) { return $prefix . '_'; } } return ''; }
[ "private", "function", "getTableNamePrefix", "(", "$", "className", ")", "{", "$", "name", "=", "ltrim", "(", "$", "className", ",", "'\\\\'", ")", ";", "foreach", "(", "$", "this", "->", "namingMap", "as", "$", "prefix", "=>", "$", "namespace", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "$", "namespace", ")", "===", "0", ")", "{", "return", "$", "prefix", ".", "'_'", ";", "}", "}", "return", "''", ";", "}" ]
Get prefix for table from naming map. @param string $className @return string
[ "Get", "prefix", "for", "table", "from", "naming", "map", "." ]
3bf895a73f991619d8f08c29fa6761b5511cad99
https://github.com/blast-project/ResourceBundle/blob/3bf895a73f991619d8f08c29fa6761b5511cad99/src/Doctrine/ORM/NamingStrategy/UnderscoredBundlePrefixStrategy.php#L147-L157
10,096
FlexPress/component-templating
src/FlexPress/Components/Templating/Functions/ThePageTitle.php
ThePageTitle.getFunctionBody
public function getFunctionBody() { global $page, $paged; wp_title('|', true, 'right'); // Add the blog name. bloginfo('name'); // Add the blog description for the home/front page. $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { echo " | ", $site_description; } // Add a page number if necessary: if ($paged >= 2 || $page >= 2) { echo ' | ', sprintf(__('Page %s', 'twentyeleven'), max($paged, $page)); } }
php
public function getFunctionBody() { global $page, $paged; wp_title('|', true, 'right'); // Add the blog name. bloginfo('name'); // Add the blog description for the home/front page. $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { echo " | ", $site_description; } // Add a page number if necessary: if ($paged >= 2 || $page >= 2) { echo ' | ', sprintf(__('Page %s', 'twentyeleven'), max($paged, $page)); } }
[ "public", "function", "getFunctionBody", "(", ")", "{", "global", "$", "page", ",", "$", "paged", ";", "wp_title", "(", "'|'", ",", "true", ",", "'right'", ")", ";", "// Add the blog name.", "bloginfo", "(", "'name'", ")", ";", "// Add the blog description for the home/front page.", "$", "site_description", "=", "get_bloginfo", "(", "'description'", ",", "'display'", ")", ";", "if", "(", "$", "site_description", "&&", "(", "is_home", "(", ")", "||", "is_front_page", "(", ")", ")", ")", "{", "echo", "\" | \"", ",", "$", "site_description", ";", "}", "// Add a page number if necessary:", "if", "(", "$", "paged", ">=", "2", "||", "$", "page", ">=", "2", ")", "{", "echo", "' | '", ",", "sprintf", "(", "__", "(", "'Page %s'", ",", "'twentyeleven'", ")", ",", "max", "(", "$", "paged", ",", "$", "page", ")", ")", ";", "}", "}" ]
The function that is executed when called in a template @return mixed @author Tim Perry
[ "The", "function", "that", "is", "executed", "when", "called", "in", "a", "template" ]
58d1cdd3cae3bfff41d987f8c8a493e6a6efd9cb
https://github.com/FlexPress/component-templating/blob/58d1cdd3cae3bfff41d987f8c8a493e6a6efd9cb/src/FlexPress/Components/Templating/Functions/ThePageTitle.php#L27-L49
10,097
indigophp-archive/codeception-fuel-module
fuel/fuel/core/classes/pagination.php
Pagination.instance
public static function instance($name = null) { if ($name !== null) { if ( ! array_key_exists($name, static::$_instances)) { return false; } return static::$_instances[$name]; } if (static::$_instance === null) { static::$_instance = static::forge(); } return static::$_instance; }
php
public static function instance($name = null) { if ($name !== null) { if ( ! array_key_exists($name, static::$_instances)) { return false; } return static::$_instances[$name]; } if (static::$_instance === null) { static::$_instance = static::forge(); } return static::$_instance; }
[ "public", "static", "function", "instance", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "!==", "null", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "static", "::", "$", "_instances", ")", ")", "{", "return", "false", ";", "}", "return", "static", "::", "$", "_instances", "[", "$", "name", "]", ";", "}", "if", "(", "static", "::", "$", "_instance", "===", "null", ")", "{", "static", "::", "$", "_instance", "=", "static", "::", "forge", "(", ")", ";", "}", "return", "static", "::", "$", "_instance", ";", "}" ]
retrieve an existing pagination instance @return \Pagination a existing pagination instance
[ "retrieve", "an", "existing", "pagination", "instance" ]
0973b7cbd540a0e89cc5bb7af94627f77f09bf49
https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L99-L117
10,098
indigophp-archive/codeception-fuel-module
fuel/fuel/core/classes/pagination.php
Pagination.render
public function render($raw = false) { // no links if we only have one page if ($this->config['total_pages'] == 1) { return $raw ? array() : ''; } $this->raw_results = array(); $html = str_replace( '{pagination}', $this->first().$this->previous().$this->pages_render().$this->next().$this->last(), $this->template['wrapper'] ); return $raw ? $this->raw_results : $html; }
php
public function render($raw = false) { // no links if we only have one page if ($this->config['total_pages'] == 1) { return $raw ? array() : ''; } $this->raw_results = array(); $html = str_replace( '{pagination}', $this->first().$this->previous().$this->pages_render().$this->next().$this->last(), $this->template['wrapper'] ); return $raw ? $this->raw_results : $html; }
[ "public", "function", "render", "(", "$", "raw", "=", "false", ")", "{", "// no links if we only have one page", "if", "(", "$", "this", "->", "config", "[", "'total_pages'", "]", "==", "1", ")", "{", "return", "$", "raw", "?", "array", "(", ")", ":", "''", ";", "}", "$", "this", "->", "raw_results", "=", "array", "(", ")", ";", "$", "html", "=", "str_replace", "(", "'{pagination}'", ",", "$", "this", "->", "first", "(", ")", ".", "$", "this", "->", "previous", "(", ")", ".", "$", "this", "->", "pages_render", "(", ")", ".", "$", "this", "->", "next", "(", ")", ".", "$", "this", "->", "last", "(", ")", ",", "$", "this", "->", "template", "[", "'wrapper'", "]", ")", ";", "return", "$", "raw", "?", "$", "this", "->", "raw_results", ":", "$", "html", ";", "}" ]
Creates the pagination markup @return mixed HTML Markup for page number links, or an array of raw pagination data
[ "Creates", "the", "pagination", "markup" ]
0973b7cbd540a0e89cc5bb7af94627f77f09bf49
https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L267-L284
10,099
indigophp-archive/codeception-fuel-module
fuel/fuel/core/classes/pagination.php
Pagination.pages_render
public function pages_render() { // no links if we only have one page if ($this->config['total_pages'] == 1) { return ''; } $html = ''; // calculate start- and end page numbers $start = $this->config['calculated_page'] - floor($this->config['num_links'] * $this->config['link_offset']); $end = $this->config['calculated_page'] + floor($this->config['num_links'] * ( 1 - $this->config['link_offset'])); // adjust for the first few pages if ($start < 1) { $end -= $start - 1; $start = 1; } // make sure we don't overshoot the current page due to rounding issues if ($end < $this->config['calculated_page']) { $start++; $end++; } // make sure we don't overshoot the total if ($end > $this->config['total_pages']) { $start = max(1, $start - $end + $this->config['total_pages']); $end = $this->config['total_pages']; } for($i = intval($start); $i <= intval($end); $i++) { if ($this->config['calculated_page'] == $i) { $html .= str_replace( '{link}', str_replace(array('{uri}', '{page}'), array('#', $i), $this->template['active-link']), $this->template['active'] ); $this->raw_results[] = array('uri' => '#', 'title' => $i, 'type' => 'active'); } else { $html .= str_replace( '{link}', str_replace(array('{uri}', '{page}'), array($this->_make_link($i), $i), $this->template['regular-link']), $this->template['regular'] ); $this->raw_results[] = array('uri' => $this->_make_link($i), 'title' => $i, 'type' => 'regular'); } } return $html; }
php
public function pages_render() { // no links if we only have one page if ($this->config['total_pages'] == 1) { return ''; } $html = ''; // calculate start- and end page numbers $start = $this->config['calculated_page'] - floor($this->config['num_links'] * $this->config['link_offset']); $end = $this->config['calculated_page'] + floor($this->config['num_links'] * ( 1 - $this->config['link_offset'])); // adjust for the first few pages if ($start < 1) { $end -= $start - 1; $start = 1; } // make sure we don't overshoot the current page due to rounding issues if ($end < $this->config['calculated_page']) { $start++; $end++; } // make sure we don't overshoot the total if ($end > $this->config['total_pages']) { $start = max(1, $start - $end + $this->config['total_pages']); $end = $this->config['total_pages']; } for($i = intval($start); $i <= intval($end); $i++) { if ($this->config['calculated_page'] == $i) { $html .= str_replace( '{link}', str_replace(array('{uri}', '{page}'), array('#', $i), $this->template['active-link']), $this->template['active'] ); $this->raw_results[] = array('uri' => '#', 'title' => $i, 'type' => 'active'); } else { $html .= str_replace( '{link}', str_replace(array('{uri}', '{page}'), array($this->_make_link($i), $i), $this->template['regular-link']), $this->template['regular'] ); $this->raw_results[] = array('uri' => $this->_make_link($i), 'title' => $i, 'type' => 'regular'); } } return $html; }
[ "public", "function", "pages_render", "(", ")", "{", "// no links if we only have one page", "if", "(", "$", "this", "->", "config", "[", "'total_pages'", "]", "==", "1", ")", "{", "return", "''", ";", "}", "$", "html", "=", "''", ";", "// calculate start- and end page numbers", "$", "start", "=", "$", "this", "->", "config", "[", "'calculated_page'", "]", "-", "floor", "(", "$", "this", "->", "config", "[", "'num_links'", "]", "*", "$", "this", "->", "config", "[", "'link_offset'", "]", ")", ";", "$", "end", "=", "$", "this", "->", "config", "[", "'calculated_page'", "]", "+", "floor", "(", "$", "this", "->", "config", "[", "'num_links'", "]", "*", "(", "1", "-", "$", "this", "->", "config", "[", "'link_offset'", "]", ")", ")", ";", "// adjust for the first few pages", "if", "(", "$", "start", "<", "1", ")", "{", "$", "end", "-=", "$", "start", "-", "1", ";", "$", "start", "=", "1", ";", "}", "// make sure we don't overshoot the current page due to rounding issues", "if", "(", "$", "end", "<", "$", "this", "->", "config", "[", "'calculated_page'", "]", ")", "{", "$", "start", "++", ";", "$", "end", "++", ";", "}", "// make sure we don't overshoot the total", "if", "(", "$", "end", ">", "$", "this", "->", "config", "[", "'total_pages'", "]", ")", "{", "$", "start", "=", "max", "(", "1", ",", "$", "start", "-", "$", "end", "+", "$", "this", "->", "config", "[", "'total_pages'", "]", ")", ";", "$", "end", "=", "$", "this", "->", "config", "[", "'total_pages'", "]", ";", "}", "for", "(", "$", "i", "=", "intval", "(", "$", "start", ")", ";", "$", "i", "<=", "intval", "(", "$", "end", ")", ";", "$", "i", "++", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'calculated_page'", "]", "==", "$", "i", ")", "{", "$", "html", ".=", "str_replace", "(", "'{link}'", ",", "str_replace", "(", "array", "(", "'{uri}'", ",", "'{page}'", ")", ",", "array", "(", "'#'", ",", "$", "i", ")", ",", "$", "this", "->", "template", "[", "'active-link'", "]", ")", ",", "$", "this", "->", "template", "[", "'active'", "]", ")", ";", "$", "this", "->", "raw_results", "[", "]", "=", "array", "(", "'uri'", "=>", "'#'", ",", "'title'", "=>", "$", "i", ",", "'type'", "=>", "'active'", ")", ";", "}", "else", "{", "$", "html", ".=", "str_replace", "(", "'{link}'", ",", "str_replace", "(", "array", "(", "'{uri}'", ",", "'{page}'", ")", ",", "array", "(", "$", "this", "->", "_make_link", "(", "$", "i", ")", ",", "$", "i", ")", ",", "$", "this", "->", "template", "[", "'regular-link'", "]", ")", ",", "$", "this", "->", "template", "[", "'regular'", "]", ")", ";", "$", "this", "->", "raw_results", "[", "]", "=", "array", "(", "'uri'", "=>", "$", "this", "->", "_make_link", "(", "$", "i", ")", ",", "'title'", "=>", "$", "i", ",", "'type'", "=>", "'regular'", ")", ";", "}", "}", "return", "$", "html", ";", "}" ]
generate the HTML for the page links only @return string Markup for the pagination block
[ "generate", "the", "HTML", "for", "the", "page", "links", "only" ]
0973b7cbd540a0e89cc5bb7af94627f77f09bf49
https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L291-L349