repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php
DocumentRule.parseRuleString
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { // Check for valid rule format // (with vendor prefix check to match e.g. "@-moz-document") if (preg_match( '/^[ \r\n\t\f]*@(' . self::getVendorPrefixRegExp("/") . ')?document[...
php
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { // Check for valid rule format // (with vendor prefix check to match e.g. "@-moz-document") if (preg_match( '/^[ \r\n\t\f]*@(' . self::getVendorPrefixRegExp("/") . ')?document[...
[ "protected", "function", "parseRuleString", "(", "$", "ruleString", ")", "{", "if", "(", "is_string", "(", "$", "ruleString", ")", ")", "{", "// Check for valid rule format", "// (with vendor prefix check to match e.g. \"@-moz-document\")", "if", "(", "preg_match", "(", ...
Parses the charset rule. @param string $ruleString
[ "Parses", "the", "charset", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L156-L252
verschoof/bunq-api
src/Resource/UserResource.php
UserResource.getUser
public function getUser($id) { $response = $this->client->get($this->getResourceEndpoint() . '/' . (int)$id); return $response['Response'][0]['UserCompany']; }
php
public function getUser($id) { $response = $this->client->get($this->getResourceEndpoint() . '/' . (int)$id); return $response['Response'][0]['UserCompany']; }
[ "public", "function", "getUser", "(", "$", "id", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "get", "(", "$", "this", "->", "getResourceEndpoint", "(", ")", ".", "'/'", ".", "(", "int", ")", "$", "id", ")", ";", "return", "...
Gets a user its information. @param integer $id @return array
[ "Gets", "a", "user", "its", "information", "." ]
train
https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/UserResource.php#L39-L44
stubbles/stubbles-webapp-core
src/main/php/routing/MethodNotAllowed.php
MethodNotAllowed.resolve
public function resolve(Request $request, Response $response) { return $response->methodNotAllowed( $request->method(), $this->allowedMethods ); }
php
public function resolve(Request $request, Response $response) { return $response->methodNotAllowed( $request->method(), $this->allowedMethods ); }
[ "public", "function", "resolve", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "return", "$", "response", "->", "methodNotAllowed", "(", "$", "request", "->", "method", "(", ")", ",", "$", "this", "->", "allowedMethods", ")", ...
creates processor instance @param \stubbles\webapp\Request $request current request @param \stubbles\webapp\Response $response response to send @return \stubbles\webapp\response\Error
[ "creates", "processor", "instance" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/MethodNotAllowed.php#L70-L76
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.load_sitemap_csv
private function load_sitemap_csv(){ // $path_sitemap_dir = $this->px->get_path_homedir().'sitemaps/'; // $ary_sitemap_files = $this->px->fs()->ls( $path_sitemap_dir ); // sort($ary_sitemap_files); // $path_top の設定値をチューニング $path_top = $this->conf->path_top; if(!strlen( $path_top )){ $path_top = '/...
php
private function load_sitemap_csv(){ // $path_sitemap_dir = $this->px->get_path_homedir().'sitemaps/'; // $ary_sitemap_files = $this->px->fs()->ls( $path_sitemap_dir ); // sort($ary_sitemap_files); // $path_top の設定値をチューニング $path_top = $this->conf->path_top; if(!strlen( $path_top )){ $path_top = '/...
[ "private", "function", "load_sitemap_csv", "(", ")", "{", "// $path_sitemap_dir = $this->px->get_path_homedir().'sitemaps/';\r", "// $ary_sitemap_files = $this->px->fs()->ls( $path_sitemap_dir );\r", "// sort($ary_sitemap_files);\r", "// $path_top の設定値をチューニング\r", "$", "path_top", "=", "$",...
サイトマップCSV(単体)を読み込む
[ "サイトマップCSV", "(", "単体", ")", "を読み込む" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L51-L219
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.get_page_info
public function get_page_info( $path, $key = null ){ if( is_null($path) ){ return null; } if( array_key_exists($path, $this->sitemap_id_map) && !is_null($this->sitemap_id_map[$path]) ){ //ページIDで指定された場合、パスに置き換える $path = $this->sitemap_id_map[$path]; } if( !preg_match( '/^(?:\/|[a-zA-Z0-9]+\:)/s', $...
php
public function get_page_info( $path, $key = null ){ if( is_null($path) ){ return null; } if( array_key_exists($path, $this->sitemap_id_map) && !is_null($this->sitemap_id_map[$path]) ){ //ページIDで指定された場合、パスに置き換える $path = $this->sitemap_id_map[$path]; } if( !preg_match( '/^(?:\/|[a-zA-Z0-9]+\:)/s', $...
[ "public", "function", "get_page_info", "(", "$", "path", ",", "$", "key", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "path", ")", ")", "{", "return", "null", ";", "}", "if", "(", "array_key_exists", "(", "$", "path", ",", "$", "this", ...
ページ情報を取得する。 このメソッドは、指定したページの情報を連想配列で返します。対象のページは第1引数にパスまたはページIDで指定します。 カレントページの情報を取得する場合は、代わりに `$px->site()->get_current_page_info()` が使用できます。 パスで指定したページの情報を取得する例 : <pre>&lt;?php // ページ &quot;/aaa/bbb.html&quot; のページ情報を得る $page_info = $px-&gt;site()-&gt;get_page_info('/aaa/bbb.html'); var_dump( $page_info ); ?&gt;</...
[ "ページ情報を取得する。" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L267-L342
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.get_children
public function get_children( $path = null, $opt = array() ){ if( is_null( $path ) ){ $path = $this->px->req()->get_request_file_path(); } $filter = true; if(!is_null(@$opt['filter'])){ $filter = !empty($opt['filter']); } $page_info = $this->get_page_info( $path ); if( $filter && is_array( @$t...
php
public function get_children( $path = null, $opt = array() ){ if( is_null( $path ) ){ $path = $this->px->req()->get_request_file_path(); } $filter = true; if(!is_null(@$opt['filter'])){ $filter = !empty($opt['filter']); } $page_info = $this->get_page_info( $path ); if( $filter && is_array( @$t...
[ "public", "function", "get_children", "(", "$", "path", "=", "null", ",", "$", "opt", "=", "array", "(", ")", ")", "{", "if", "(", "is_null", "(", "$", "path", ")", ")", "{", "$", "path", "=", "$", "this", "->", "px", "->", "req", "(", ")", "...
子階層のページの一覧を取得する。 このメソッドは、指定したページの子階層のページの一覧を返します。`$path` を省略した場合は、カレントページのパスを起点に一覧を抽出します。 カレントページの子階層のリンクを作成する例 : <pre>&lt;?php // カレントページの子階層のリンクを作成する $children = $px-&gt;site()-&gt;get_children(); print '&lt;ul&gt;'; foreach( $children as $child ){ print '&lt;li&gt;'.$px-&gt;theme()-&gt;mk_link($child).'&lt;/li&gt;...
[ "子階層のページの一覧を取得する。" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L380-L399
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.usort_sitemap
private function usort_sitemap( $a , $b ){ $page_info_a = $this->get_page_info( $a ); $page_info_b = $this->get_page_info( $b ); $orderby_a = $page_info_a['orderby']; $orderby_b = $page_info_b['orderby']; if( strlen( $orderby_a ) && !strlen( $orderby_b ) ){ return -1; }elseif( strlen( $orderby_b )...
php
private function usort_sitemap( $a , $b ){ $page_info_a = $this->get_page_info( $a ); $page_info_b = $this->get_page_info( $b ); $orderby_a = $page_info_a['orderby']; $orderby_b = $page_info_b['orderby']; if( strlen( $orderby_a ) && !strlen( $orderby_b ) ){ return -1; }elseif( strlen( $orderby_b )...
[ "private", "function", "usort_sitemap", "(", "$", "a", ",", "$", "b", ")", "{", "$", "page_info_a", "=", "$", "this", "->", "get_page_info", "(", "$", "a", ")", ";", "$", "page_info_b", "=", "$", "this", "->", "get_page_info", "(", "$", "b", ")", "...
ページ情報の配列を並び替える。 @param string $a 比較対象1のページID @param string $b 比較対象2のページID @return int 並び順の前後関係 (`1`|`0`|`-1`)
[ "ページ情報の配列を並び替える。" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L408-L423
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.get_dynamic_path_info
public function get_dynamic_path_info( $path ){ foreach( $this->sitemap_dynamic_paths as $sitemap_dynamic_path ){ //ダイナミックパスを検索 if( $sitemap_dynamic_path['path_original'] == $path ){ return $sitemap_dynamic_path; } if( preg_match( $sitemap_dynamic_path['preg'] , $path ) ){ return $sitemap_d...
php
public function get_dynamic_path_info( $path ){ foreach( $this->sitemap_dynamic_paths as $sitemap_dynamic_path ){ //ダイナミックパスを検索 if( $sitemap_dynamic_path['path_original'] == $path ){ return $sitemap_dynamic_path; } if( preg_match( $sitemap_dynamic_path['preg'] , $path ) ){ return $sitemap_d...
[ "public", "function", "get_dynamic_path_info", "(", "$", "path", ")", "{", "foreach", "(", "$", "this", "->", "sitemap_dynamic_paths", "as", "$", "sitemap_dynamic_path", ")", "{", "//ダイナミックパスを検索\r", "if", "(", "$", "sitemap_dynamic_path", "[", "'path_original'", "...
ダイナミックパス情報を得る。 @param string $path 対象のパス @return string|bool 見つかった場合に、ダイナミックパスを、見つからない場合に `false` を返します。
[ "ダイナミックパス情報を得る。" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L431-L442
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.get_max_depth
public function get_max_depth(){ if( is_int($this->max_depth) ){ return $this->max_depth; } $this->max_depth = 0; foreach( $this->get_sitemap() as $page_info ){ $tmp_breadcrumb = explode('>',$page_info['logical_path']); if( $this->max_depth < count($tmp_breadcrumb) ){ $this->max_depth = c...
php
public function get_max_depth(){ if( is_int($this->max_depth) ){ return $this->max_depth; } $this->max_depth = 0; foreach( $this->get_sitemap() as $page_info ){ $tmp_breadcrumb = explode('>',$page_info['logical_path']); if( $this->max_depth < count($tmp_breadcrumb) ){ $this->max_depth = c...
[ "public", "function", "get_max_depth", "(", ")", "{", "if", "(", "is_int", "(", "$", "this", "->", "max_depth", ")", ")", "{", "return", "$", "this", "->", "max_depth", ";", "}", "$", "this", "->", "max_depth", "=", "0", ";", "foreach", "(", "$", "...
パンくずの最大の深さを計測
[ "パンくずの最大の深さを計測" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L447-L461
pickles2/px2-sitemapexcel
php/helper/parseSitemapCsv.php
pxplugin_sitemapExcel_helper_parseSitemapCsv.done
public function done($path){ $page_info = $this->get_page_info($path); unset($this->sitemap_array[$page_info['path']]); unset($this->sitemap_id_map[$page_info['id']]); return true; }
php
public function done($path){ $page_info = $this->get_page_info($path); unset($this->sitemap_array[$page_info['path']]); unset($this->sitemap_id_map[$page_info['id']]); return true; }
[ "public", "function", "done", "(", "$", "path", ")", "{", "$", "page_info", "=", "$", "this", "->", "get_page_info", "(", "$", "path", ")", ";", "unset", "(", "$", "this", "->", "sitemap_array", "[", "$", "page_info", "[", "'path'", "]", "]", ")", ...
指定したページの変換が完了したことを記録する
[ "指定したページの変換が完了したことを記録する" ]
train
https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/helper/parseSitemapCsv.php#L466-L471
andyvenus/form
src/FormView.php
FormView.getSectionFields
public function getSectionFields($section, $flatten = true) { if ($flatten === false) { $fields = $this->fields; } else { $fields = $this->getFlattenedFields(); } $matchedFields = array(); foreach ($fields as $fieldName => $field) { if (is...
php
public function getSectionFields($section, $flatten = true) { if ($flatten === false) { $fields = $this->fields; } else { $fields = $this->getFlattenedFields(); } $matchedFields = array(); foreach ($fields as $fieldName => $field) { if (is...
[ "public", "function", "getSectionFields", "(", "$", "section", ",", "$", "flatten", "=", "true", ")", "{", "if", "(", "$", "flatten", "===", "false", ")", "{", "$", "fields", "=", "$", "this", "->", "fields", ";", "}", "else", "{", "$", "fields", "...
Get fields for a certain section @param $section @param bool $flatten @return array
[ "Get", "fields", "for", "a", "certain", "section" ]
train
https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L188-L204
andyvenus/form
src/FormView.php
FormView.getFlattenedFields
public function getFlattenedFields() { if (!isset($this->flatFields)) { $this->flatFields = []; foreach ($this->fields as $field) { if (isset($field['fields']) && is_array($field['fields'])) { $this->flatFields += $this->flattenCollection($field);...
php
public function getFlattenedFields() { if (!isset($this->flatFields)) { $this->flatFields = []; foreach ($this->fields as $field) { if (isset($field['fields']) && is_array($field['fields'])) { $this->flatFields += $this->flattenCollection($field);...
[ "public", "function", "getFlattenedFields", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "flatFields", ")", ")", "{", "$", "this", "->", "flatFields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "f...
Flatten all fields by moving collections into the main array @return array
[ "Flatten", "all", "fields", "by", "moving", "collections", "into", "the", "main", "array" ]
train
https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L211-L226
andyvenus/form
src/FormView.php
FormView.flattenCollection
protected function flattenCollection($field) { if (!isset($field['fields']) || !is_array($field['fields'])) { return []; } $fields = []; foreach ($field['fields'] as $field) { if (isset($field['fields']) && is_array($field['fields'])) { $fiel...
php
protected function flattenCollection($field) { if (!isset($field['fields']) || !is_array($field['fields'])) { return []; } $fields = []; foreach ($field['fields'] as $field) { if (isset($field['fields']) && is_array($field['fields'])) { $fiel...
[ "protected", "function", "flattenCollection", "(", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "field", "[", "'fields'", "]", ")", "||", "!", "is_array", "(", "$", "field", "[", "'fields'", "]", ")", ")", "{", "return", "[", "]", ";"...
Flatten the fields in a collection @param $field @return array
[ "Flatten", "the", "fields", "in", "a", "collection" ]
train
https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L234-L251
andyvenus/form
src/FormView.php
FormView.getFieldsWithoutSection
public function getFieldsWithoutSection() { $matchedFields = array(); foreach ($this->fields as $fieldName => $field) { if (!isset($field['options']['section']) || $field['options']['section'] === null || $field['options']['section'] === '') { $matchedFields[$fieldName] =...
php
public function getFieldsWithoutSection() { $matchedFields = array(); foreach ($this->fields as $fieldName => $field) { if (!isset($field['options']['section']) || $field['options']['section'] === null || $field['options']['section'] === '') { $matchedFields[$fieldName] =...
[ "public", "function", "getFieldsWithoutSection", "(", ")", "{", "$", "matchedFields", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "fieldName", "=>", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "...
Get any fields that don't have a section set @return array
[ "Get", "any", "fields", "that", "don", "t", "have", "a", "section", "set" ]
train
https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L258-L268
andyvenus/form
src/FormView.php
FormView.translate
protected function translate($str, $params = array()) { if (isset($this->translator)) { return $this->translator->trans($str, $params); } else { $finalParams = array(); foreach ($params as $placeholder => $value) { $finalParams['{'.$placeho...
php
protected function translate($str, $params = array()) { if (isset($this->translator)) { return $this->translator->trans($str, $params); } else { $finalParams = array(); foreach ($params as $placeholder => $value) { $finalParams['{'.$placeho...
[ "protected", "function", "translate", "(", "$", "str", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "translator", ")", ")", "{", "return", "$", "this", "->", "translator", "->", "trans", "(", "$"...
Translate a string if the translator has been injected @param $str string The string that will be translated @param array $params @return string
[ "Translate", "a", "string", "if", "the", "translator", "has", "been", "injected" ]
train
https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L377-L389
jelix/ldapdao-module
ldapdao/plugins/auth/ldapdao/ldapdao.auth.php
ldapdaoAuthDriver._getLinkId
protected function _getLinkId() { if ($connect = ldap_connect($this->_params['hostname'], $this->_params['port'])) { ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, $this->_params['protocolVersion']); ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); return $connect;...
php
protected function _getLinkId() { if ($connect = ldap_connect($this->_params['hostname'], $this->_params['port'])) { ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, $this->_params['protocolVersion']); ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); return $connect;...
[ "protected", "function", "_getLinkId", "(", ")", "{", "if", "(", "$", "connect", "=", "ldap_connect", "(", "$", "this", "->", "_params", "[", "'hostname'", "]", ",", "$", "this", "->", "_params", "[", "'port'", "]", ")", ")", "{", "ldap_set_option", "(...
open the connection to the ldap server
[ "open", "the", "connection", "to", "the", "ldap", "server" ]
train
https://github.com/jelix/ldapdao-module/blob/8261aadf643e95c98fcb96f5d65fa007977418cd/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php#L467-L475
jelix/ldapdao-module
ldapdao/plugins/auth/ldapdao/ldapdao.auth.php
ldapdaoAuthDriver._bindLdapAdminUser
protected function _bindLdapAdminUser() { $connect = $this->_getLinkId(); if (!$connect) { jLog::log('ldapdao: impossible to connect to ldap', 'auth'); return false; } if ($this->_params['adminUserDn'] == '') { $bind = ldap_bind($connect); ...
php
protected function _bindLdapAdminUser() { $connect = $this->_getLinkId(); if (!$connect) { jLog::log('ldapdao: impossible to connect to ldap', 'auth'); return false; } if ($this->_params['adminUserDn'] == '') { $bind = ldap_bind($connect); ...
[ "protected", "function", "_bindLdapAdminUser", "(", ")", "{", "$", "connect", "=", "$", "this", "->", "_getLinkId", "(", ")", ";", "if", "(", "!", "$", "connect", ")", "{", "jLog", "::", "log", "(", "'ldapdao: impossible to connect to ldap'", ",", "'auth'", ...
open the connection to the ldap server and bind to the admin user @return resource|false the ldap connection
[ "open", "the", "connection", "to", "the", "ldap", "server", "and", "bind", "to", "the", "admin", "user" ]
train
https://github.com/jelix/ldapdao-module/blob/8261aadf643e95c98fcb96f5d65fa007977418cd/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php#L482-L505
ftrrtf/FtrrtfRollbarBundle
Rollbar/Environment.php
Environment.getRequestData
public function getRequestData() { parent::getRequestData(); if ($this->getRequest() instanceof Request) { if (in_array($this->getRequest()->getMethod(), array('PUT', 'DELETE'))) { $this->requestData[$this->getRequest()->getMethod()] = $this->getRequest()->request->all()...
php
public function getRequestData() { parent::getRequestData(); if ($this->getRequest() instanceof Request) { if (in_array($this->getRequest()->getMethod(), array('PUT', 'DELETE'))) { $this->requestData[$this->getRequest()->getMethod()] = $this->getRequest()->request->all()...
[ "public", "function", "getRequestData", "(", ")", "{", "parent", "::", "getRequestData", "(", ")", ";", "if", "(", "$", "this", "->", "getRequest", "(", ")", "instanceof", "Request", ")", "{", "if", "(", "in_array", "(", "$", "this", "->", "getRequest", ...
Cached values for request. @return array|null
[ "Cached", "values", "for", "request", "." ]
train
https://github.com/ftrrtf/FtrrtfRollbarBundle/blob/64c75862b80a4a1ed9e98c0d217003e84df40dd7/Rollbar/Environment.php#L25-L36
puli/discovery
src/Api/Type/BindingType.php
BindingType.getParameter
public function getParameter($name) { if (!isset($this->parameters[$name])) { throw new NoSuchParameterException(sprintf( 'The parameter "%s" does not exist on type "%s".', $name, $this->name )); } return $this->paramet...
php
public function getParameter($name) { if (!isset($this->parameters[$name])) { throw new NoSuchParameterException(sprintf( 'The parameter "%s" does not exist on type "%s".', $name, $this->name )); } return $this->paramet...
[ "public", "function", "getParameter", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "parameters", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "NoSuchParameterException", "(", "sprintf", "(", "'The parameter \"%s\" d...
Returns a parameter by name. @param string $name The parameter name. @return BindingParameter The parameter. @throws NoSuchParameterException If the parameter was not found.
[ "Returns", "a", "parameter", "by", "name", "." ]
train
https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingType.php#L150-L161
puli/discovery
src/Api/Type/BindingType.php
BindingType.hasParameterValues
public function hasParameterValues() { foreach ($this->parameters as $name => $parameter) { if (!$parameter->isRequired()) { return true; } } return false; }
php
public function hasParameterValues() { foreach ($this->parameters as $name => $parameter) { if (!$parameter->isRequired()) { return true; } } return false; }
[ "public", "function", "hasParameterValues", "(", ")", "{", "foreach", "(", "$", "this", "->", "parameters", "as", "$", "name", "=>", "$", "parameter", ")", "{", "if", "(", "!", "$", "parameter", "->", "isRequired", "(", ")", ")", "{", "return", "true",...
Returns whether the type has parameters with default values. @return bool Returns `true` if at least one parameter has a default value and `false` otherwise.
[ "Returns", "whether", "the", "type", "has", "parameters", "with", "default", "values", "." ]
train
https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingType.php#L199-L208
puli/discovery
src/Api/Type/BindingType.php
BindingType.acceptsBinding
public function acceptsBinding($binding) { return $binding instanceof $this->acceptedBindingClass || $binding === $this->acceptedBindingClass || is_subclass_of($binding, $this->acceptedBindingClass); }
php
public function acceptsBinding($binding) { return $binding instanceof $this->acceptedBindingClass || $binding === $this->acceptedBindingClass || is_subclass_of($binding, $this->acceptedBindingClass); }
[ "public", "function", "acceptsBinding", "(", "$", "binding", ")", "{", "return", "$", "binding", "instanceof", "$", "this", "->", "acceptedBindingClass", "||", "$", "binding", "===", "$", "this", "->", "acceptedBindingClass", "||", "is_subclass_of", "(", "$", ...
Returns whether the type accepts a binding class. @param Binding|string $binding The binding or the fully-qualified name of the binding class. @return bool Returns `true` if the binding can be bound to this type and `false` otherwise.
[ "Returns", "whether", "the", "type", "accepts", "a", "binding", "class", "." ]
train
https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingType.php#L248-L253
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.updateApiEntity
public function updateApiEntity(Order $apiOrder, $locale) { $items = $apiOrder->getItems(); // perform price calucaltion $prices = $supplierItems = null; $totalPrice = $this->priceCalculator->calculate($items, $prices, $supplierItems); if ($supplierItems) { $sup...
php
public function updateApiEntity(Order $apiOrder, $locale) { $items = $apiOrder->getItems(); // perform price calucaltion $prices = $supplierItems = null; $totalPrice = $this->priceCalculator->calculate($items, $prices, $supplierItems); if ($supplierItems) { $sup...
[ "public", "function", "updateApiEntity", "(", "Order", "$", "apiOrder", ",", "$", "locale", ")", "{", "$", "items", "=", "$", "apiOrder", "->", "getItems", "(", ")", ";", "// perform price calucaltion", "$", "prices", "=", "$", "supplierItems", "=", "null", ...
Function updates the api-entity, like price-calculations @param Order $apiOrder
[ "Function", "updates", "the", "api", "-", "entity", "like", "price", "-", "calculations" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L362-L392
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.getContactData
public function getContactData($addressData, $contact) { $result = array(); // if account is set, take account's name if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) { $result['firstName'] = $addressData['firstName']; $result['...
php
public function getContactData($addressData, $contact) { $result = array(); // if account is set, take account's name if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) { $result['firstName'] = $addressData['firstName']; $result['...
[ "public", "function", "getContactData", "(", "$", "addressData", ",", "$", "contact", ")", "{", "$", "result", "=", "array", "(", ")", ";", "// if account is set, take account's name", "if", "(", "$", "addressData", "&&", "isset", "(", "$", "addressData", "[",...
Returns contact data as an array. Either by provided address or contact @param array $addressData @param Contact $contact @throws MissingOrderAttributeException @return array
[ "Returns", "contact", "data", "as", "an", "array", ".", "Either", "by", "provided", "address", "or", "contact" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L404-L433
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.convertStatus
public function convertStatus($order, $statusId, $flush = false, $persist = true) { if ($order instanceof Order) { $order = $order->getEntity(); } // get current status $currentStatus = $order->getStatus(); if ($currentStatus) { if ($currentStatus ins...
php
public function convertStatus($order, $statusId, $flush = false, $persist = true) { if ($order instanceof Order) { $order = $order->getEntity(); } // get current status $currentStatus = $order->getStatus(); if ($currentStatus) { if ($currentStatus ins...
[ "public", "function", "convertStatus", "(", "$", "order", ",", "$", "statusId", ",", "$", "flush", "=", "false", ",", "$", "persist", "=", "true", ")", "{", "if", "(", "$", "order", "instanceof", "Order", ")", "{", "$", "order", "=", "$", "order", ...
Converts the status of an order @param ApiOrderInterface|OrderInterface $order @param int $statusId @param bool $flush @param bool $persist @throws \Sulu\Component\Rest\Exception\EntityNotFoundException
[ "Converts", "the", "status", "of", "an", "order" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L485-L544
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.findOrderEntityById
public function findOrderEntityById($id) { try { return $this->em ->getRepository(static::$orderEntityName) ->find($id); } catch (NoResultException $nre) { throw new EntityNotFoundException(static::$orderEntityName, $id); } }
php
public function findOrderEntityById($id) { try { return $this->em ->getRepository(static::$orderEntityName) ->find($id); } catch (NoResultException $nre) { throw new EntityNotFoundException(static::$orderEntityName, $id); } }
[ "public", "function", "findOrderEntityById", "(", "$", "id", ")", "{", "try", "{", "return", "$", "this", "->", "em", "->", "getRepository", "(", "static", "::", "$", "orderEntityName", ")", "->", "find", "(", "$", "id", ")", ";", "}", "catch", "(", ...
Find order entity by id @param $id @throws \Sulu\Component\Rest\Exception\EntityNotFoundException @return OrderInterface
[ "Find", "order", "entity", "by", "id" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L575-L584
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.findOrderEntityForItemWithId
public function findOrderEntityForItemWithId($id, $returnMultipleResults = false) { try { return $this->em ->getRepository(static::$orderEntityName) ->findOrderForItemWithId($id, $returnMultipleResults); } catch (NoResultException $nre) { throw...
php
public function findOrderEntityForItemWithId($id, $returnMultipleResults = false) { try { return $this->em ->getRepository(static::$orderEntityName) ->findOrderForItemWithId($id, $returnMultipleResults); } catch (NoResultException $nre) { throw...
[ "public", "function", "findOrderEntityForItemWithId", "(", "$", "id", ",", "$", "returnMultipleResults", "=", "false", ")", "{", "try", "{", "return", "$", "this", "->", "em", "->", "getRepository", "(", "static", "::", "$", "orderEntityName", ")", "->", "fi...
Find order for item with id @param int $id @throws \Sulu\Component\Rest\Exception\EntityNotFoundException @return OrderInterface
[ "Find", "order", "for", "item", "with", "id" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L595-L604
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.addItem
public function addItem($itemData, $locale, $userId, $order) { $item = $this->itemManager->save($itemData, $locale, $userId); $order->addItem($item->getEntity()); return $item; }
php
public function addItem($itemData, $locale, $userId, $order) { $item = $this->itemManager->save($itemData, $locale, $userId); $order->addItem($item->getEntity()); return $item; }
[ "public", "function", "addItem", "(", "$", "itemData", ",", "$", "locale", ",", "$", "userId", ",", "$", "order", ")", "{", "$", "item", "=", "$", "this", "->", "itemManager", "->", "save", "(", "$", "itemData", ",", "$", "locale", ",", "$", "userI...
@param array $itemData @param string $locale @param int $userId @param Order $order @return ApiItemInterface
[ "@param", "array", "$itemData", "@param", "string", "$locale", "@param", "int", "$userId", "@param", "Order", "$order" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L708-L715
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.updateItem
public function updateItem(ItemInterface $item, $itemData, $locale, $userId) { return $this->itemManager->save($itemData, $locale, $userId, $item); }
php
public function updateItem(ItemInterface $item, $itemData, $locale, $userId) { return $this->itemManager->save($itemData, $locale, $userId, $item); }
[ "public", "function", "updateItem", "(", "ItemInterface", "$", "item", ",", "$", "itemData", ",", "$", "locale", ",", "$", "userId", ")", "{", "return", "$", "this", "->", "itemManager", "->", "save", "(", "$", "itemData", ",", "$", "locale", ",", "$",...
@param ItemInterface $item @param array $itemData @param string $locale @param int $userId @return null|\Sulu\Bundle\Sales\CoreBundle\Api\Item
[ "@param", "ItemInterface", "$item", "@param", "array", "$itemData", "@param", "string", "$locale", "@param", "int", "$userId" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L725-L728
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.createMediaForSupplierItems
protected function createMediaForSupplierItems($items, $locale) { foreach ($items as $item) { if (isset($item['items']) && count($item['items'] > 0)) { $this->createMediaForItems($item['items'], $locale); } } }
php
protected function createMediaForSupplierItems($items, $locale) { foreach ($items as $item) { if (isset($item['items']) && count($item['items'] > 0)) { $this->createMediaForItems($item['items'], $locale); } } }
[ "protected", "function", "createMediaForSupplierItems", "(", "$", "items", ",", "$", "locale", ")", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "if", "(", "isset", "(", "$", "item", "[", "'items'", "]", ")", "&&", "count", "(", "$...
Creates correct media-api for supplier-items array @param array $items @param string $locale
[ "Creates", "correct", "media", "-", "api", "for", "supplier", "-", "items", "array" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L790-L797
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.createMediaForItems
protected function createMediaForItems($items, $locale) { foreach ($items as $item) { $product = $item->getProduct(); if ($product) { $this->productManager->createProductMedia($product, $locale); } // Set api product for returning media-urls ...
php
protected function createMediaForItems($items, $locale) { foreach ($items as $item) { $product = $item->getProduct(); if ($product) { $this->productManager->createProductMedia($product, $locale); } // Set api product for returning media-urls ...
[ "protected", "function", "createMediaForItems", "(", "$", "items", ",", "$", "locale", ")", "{", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "product", "=", "$", "item", "->", "getProduct", "(", ")", ";", "if", "(", "$", "product"...
Creates correct media-api for items array @param array $items @param string $locale
[ "Creates", "correct", "media", "-", "api", "for", "items", "array" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L805-L815
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.setOrderType
private function setOrderType($data, ApiOrderInterface $order, $patch = false) { // get OrderType $type = $this->getProperty($data, 'type', $order->getType()); // set order type if (isset($data['type'])) { if (is_array($type) && isset($type['id'])) { // if...
php
private function setOrderType($data, ApiOrderInterface $order, $patch = false) { // get OrderType $type = $this->getProperty($data, 'type', $order->getType()); // set order type if (isset($data['type'])) { if (is_array($type) && isset($type['id'])) { // if...
[ "private", "function", "setOrderType", "(", "$", "data", ",", "ApiOrderInterface", "$", "order", ",", "$", "patch", "=", "false", ")", "{", "// get OrderType", "$", "type", "=", "$", "this", "->", "getProperty", "(", "$", "data", ",", "'type'", ",", "$",...
Sets OrderType on an order @param array $data @param ApiOrderInterface $order @throws EntityNotFoundException @throws OrderException
[ "Sets", "OrderType", "on", "an", "order" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L888-L919
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.initializeFieldDescriptors
private function initializeFieldDescriptors($locale) { $this->fieldDescriptors['id'] = new DoctrineFieldDescriptor( 'id', 'id', static::$orderEntityName, 'public.id', array(), true, false, 'string' ); ...
php
private function initializeFieldDescriptors($locale) { $this->fieldDescriptors['id'] = new DoctrineFieldDescriptor( 'id', 'id', static::$orderEntityName, 'public.id', array(), true, false, 'string' ); ...
[ "private", "function", "initializeFieldDescriptors", "(", "$", "locale", ")", "{", "$", "this", "->", "fieldDescriptors", "[", "'id'", "]", "=", "new", "DoctrineFieldDescriptor", "(", "'id'", ",", "'id'", ",", "static", "::", "$", "orderEntityName", ",", "'pub...
Initializes field descriptors @param string $locale
[ "Initializes", "field", "descriptors" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L926-L1093
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.addContactRelation
private function addContactRelation(array $data, $key, $addCallback) { $contact = null; if (array_key_exists($key, $data) && is_array($data[$key]) && array_key_exists('id', $data[$key]) ) { /** @var Contact $contact */ $contactId = $data[$key][...
php
private function addContactRelation(array $data, $key, $addCallback) { $contact = null; if (array_key_exists($key, $data) && is_array($data[$key]) && array_key_exists('id', $data[$key]) ) { /** @var Contact $contact */ $contactId = $data[$key][...
[ "private", "function", "addContactRelation", "(", "array", "$", "data", ",", "$", "key", ",", "$", "addCallback", ")", "{", "$", "contact", "=", "null", ";", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "data", ")", "&&", "is_array", "(", ...
Searches for contact in specified data and calls callback function @param array $data @param string $key @param callable $addCallback @throws Exception\MissingOrderAttributeException @throws Exception\OrderDependencyNotFoundException @return Contact|null
[ "Searches", "for", "contact", "in", "specified", "data", "and", "calls", "callback", "function" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1145-L1162
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.setTermsOfDelivery
private function setTermsOfDelivery($data, Order $order, $patch = false) { $terms = null; // terms of delivery $termsOfDeliveryData = $this->getProperty($data, 'termsOfDelivery'); $termsOfDeliveryContentData = $this->getProperty($data, 'termsOfDeliveryContent'); if ($termsOfD...
php
private function setTermsOfDelivery($data, Order $order, $patch = false) { $terms = null; // terms of delivery $termsOfDeliveryData = $this->getProperty($data, 'termsOfDelivery'); $termsOfDeliveryContentData = $this->getProperty($data, 'termsOfDeliveryContent'); if ($termsOfD...
[ "private", "function", "setTermsOfDelivery", "(", "$", "data", ",", "Order", "$", "order", ",", "$", "patch", "=", "false", ")", "{", "$", "terms", "=", "null", ";", "// terms of delivery", "$", "termsOfDeliveryData", "=", "$", "this", "->", "getProperty", ...
@param array $data @param Order $order @param bool $patch @throws MissingOrderAttributeException @throws OrderDependencyNotFoundException @return null|object
[ "@param", "array", "$data", "@param", "Order", "$order", "@param", "bool", "$patch" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1174-L1204
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.setTermsOfPayment
private function setTermsOfPayment($data, Order $order, $patch = false) { $terms = null; // terms of delivery $termsOfPaymentData = $this->getProperty($data, 'termsOfPayment'); $termsOfPaymentContentData = $this->getProperty($data, 'termsOfPaymentContent'); if ($termsOfPaymen...
php
private function setTermsOfPayment($data, Order $order, $patch = false) { $terms = null; // terms of delivery $termsOfPaymentData = $this->getProperty($data, 'termsOfPayment'); $termsOfPaymentContentData = $this->getProperty($data, 'termsOfPaymentContent'); if ($termsOfPaymen...
[ "private", "function", "setTermsOfPayment", "(", "$", "data", ",", "Order", "$", "order", ",", "$", "patch", "=", "false", ")", "{", "$", "terms", "=", "null", ";", "// terms of delivery", "$", "termsOfPaymentData", "=", "$", "this", "->", "getProperty", "...
@param array $data @param Order $order @param bool $patch @throws MissingOrderAttributeException @throws OrderDependencyNotFoundException @return null|object
[ "@param", "array", "$data", "@param", "Order", "$order", "@param", "bool", "$patch" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1216-L1246
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.setCustomerAccount
private function setCustomerAccount($data, Order $order, $patch = false) { $accountData = $this->getProperty($data, 'customerAccount'); if ($accountData) { if (!array_key_exists('id', $accountData)) { throw new MissingOrderAttributeException('account.id'); } ...
php
private function setCustomerAccount($data, Order $order, $patch = false) { $accountData = $this->getProperty($data, 'customerAccount'); if ($accountData) { if (!array_key_exists('id', $accountData)) { throw new MissingOrderAttributeException('account.id'); } ...
[ "private", "function", "setCustomerAccount", "(", "$", "data", ",", "Order", "$", "order", ",", "$", "patch", "=", "false", ")", "{", "$", "accountData", "=", "$", "this", "->", "getProperty", "(", "$", "data", ",", "'customerAccount'", ")", ";", "if", ...
Sets the customer account of an order @param array $data @param Order $order @param bool $patch @return null|object @throws MissingOrderAttributeException @throws OrderDependencyNotFoundException
[ "Sets", "the", "customer", "account", "of", "an", "order" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1259-L1278
sulu/SuluSalesShippingBundle
src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php
OrderManager.processItems
private function processItems($data, Order $order, $locale, $userId = null) { $result = true; try { if ($this->checkIfSet('items', $data)) { // items has to be an array if (!is_array($data['items'])) { throw new MissingOrderAttributeExc...
php
private function processItems($data, Order $order, $locale, $userId = null) { $result = true; try { if ($this->checkIfSet('items', $data)) { // items has to be an array if (!is_array($data['items'])) { throw new MissingOrderAttributeExc...
[ "private", "function", "processItems", "(", "$", "data", ",", "Order", "$", "order", ",", "$", "locale", ",", "$", "userId", "=", "null", ")", "{", "$", "result", "=", "true", ";", "try", "{", "if", "(", "$", "this", "->", "checkIfSet", "(", "'item...
Processes items defined in an order and creates item entities @param array $data @param Order $order @param string $locale @param int $userId @throws Exception\OrderException @return bool
[ "Processes", "items", "defined", "in", "an", "order", "and", "creates", "item", "entities" ]
train
https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1292-L1337
gregorybesson/PlaygroundCore
src/Service/Formgen.php
Formgen.getFormgenMapper
public function getFormgenMapper() { if (null === $this->formgenMapper) { $this->formgenMapper = $this->serviceLocator->get('playgroundcore_formgen_mapper'); } return $this->formgenMapper; }
php
public function getFormgenMapper() { if (null === $this->formgenMapper) { $this->formgenMapper = $this->serviceLocator->get('playgroundcore_formgen_mapper'); } return $this->formgenMapper; }
[ "public", "function", "getFormgenMapper", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "formgenMapper", ")", "{", "$", "this", "->", "formgenMapper", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'playgroundcore_formgen_mapper'", ...
getFormgenMapper @return FormgenMapper
[ "getFormgenMapper" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Formgen.php#L374-L381
phpthinktank/blast-facades
src/FacadeFactory.php
FacadeFactory.create
public static function create($accessor, $name, array $arguments = []) { $container = static::getContainer(); $object = $container->get($accessor); return call_user_func_array([$object, $name], $arguments); }
php
public static function create($accessor, $name, array $arguments = []) { $container = static::getContainer(); $object = $container->get($accessor); return call_user_func_array([$object, $name], $arguments); }
[ "public", "static", "function", "create", "(", "$", "accessor", ",", "$", "name", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "container", "=", "static", "::", "getContainer", "(", ")", ";", "$", "object", "=", "$", "container", "->...
Get provided accessor from container and call method @param $accessor @param $name @param $arguments @return mixed
[ "Get", "provided", "accessor", "from", "container", "and", "call", "method" ]
train
https://github.com/phpthinktank/blast-facades/blob/859fd8352f63febf3e1189ea3142afa5d6d8b9af/src/FacadeFactory.php#L48-L54
gdbots/pbjx-bundle-php
src/Command/CreateEventSearchStorageCommand.php
CreateEventSearchStorageCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $context = json_decode($input->getOption('context') ?: '{}', true); $context['tenant_id'] = (string)$input->getOption('tenant-id'); $io = new SymfonyStyle($input, $output); $io->title('EventSearch Storage C...
php
protected function execute(InputInterface $input, OutputInterface $output) { $context = json_decode($input->getOption('context') ?: '{}', true); $context['tenant_id'] = (string)$input->getOption('tenant-id'); $io = new SymfonyStyle($input, $output); $io->title('EventSearch Storage C...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "context", "=", "json_decode", "(", "$", "input", "->", "getOption", "(", "'context'", ")", "?", ":", "'{}'", ",", "true", ")", ...
@param InputInterface $input @param OutputInterface $output @return null @throws \Exception
[ "@param", "InputInterface", "$input", "@param", "OutputInterface", "$output" ]
train
https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/CreateEventSearchStorageCommand.php#L63-L74
SachaMorard/phalcon-console
Library/Phalcon/Commands/Builtin/Enumerate.php
Enumerate.run
public function run(array $parameters) { print Color::colorize('Available commands:', Color::FG_BROWN) . PHP_EOL; foreach ($this->getScript()->getCommands() as $commands) { $providedCommands = $commands->getCommands(); $commandLen = strlen($providedCommands[0]); ...
php
public function run(array $parameters) { print Color::colorize('Available commands:', Color::FG_BROWN) . PHP_EOL; foreach ($this->getScript()->getCommands() as $commands) { $providedCommands = $commands->getCommands(); $commandLen = strlen($providedCommands[0]); ...
[ "public", "function", "run", "(", "array", "$", "parameters", ")", "{", "print", "Color", "::", "colorize", "(", "'Available commands:'", ",", "Color", "::", "FG_BROWN", ")", ".", "PHP_EOL", ";", "foreach", "(", "$", "this", "->", "getScript", "(", ")", ...
{@inheritdoc} @param array $parameters @return mixed
[ "{", "@inheritdoc", "}" ]
train
https://github.com/SachaMorard/phalcon-console/blob/a7922e4c488ea19bc0ecce793e6f01cf9cf3c0c3/Library/Phalcon/Commands/Builtin/Enumerate.php#L53-L69
SachaMorard/phalcon-console
Library/Phalcon/Commands/Builtin/Enumerate.php
Enumerate.getHelp
public function getHelp() { print Color::head('Help:') . PHP_EOL; print Color::colorize(' Lists the commands available in Console') . PHP_EOL . PHP_EOL; $this->run([]); }
php
public function getHelp() { print Color::head('Help:') . PHP_EOL; print Color::colorize(' Lists the commands available in Console') . PHP_EOL . PHP_EOL; $this->run([]); }
[ "public", "function", "getHelp", "(", ")", "{", "print", "Color", "::", "head", "(", "'Help:'", ")", ".", "PHP_EOL", ";", "print", "Color", "::", "colorize", "(", "' Lists the commands available in Console'", ")", ".", "PHP_EOL", ".", "PHP_EOL", ";", "$", "...
{@inheritdoc} @return void
[ "{", "@inheritdoc", "}" ]
train
https://github.com/SachaMorard/phalcon-console/blob/a7922e4c488ea19bc0ecce793e6f01cf9cf3c0c3/Library/Phalcon/Commands/Builtin/Enumerate.php#L96-L102
ripaclub/zf2-sphinxsearch-tool
src/Source/Writer/TSV.php
TSV.openURI
public function openURI($uri) { $this->handle = fopen($uri, 'w'); if (!$this->handle) { return false; } else { return true; } }
php
public function openURI($uri) { $this->handle = fopen($uri, 'w'); if (!$this->handle) { return false; } else { return true; } }
[ "public", "function", "openURI", "(", "$", "uri", ")", "{", "$", "this", "->", "handle", "=", "fopen", "(", "$", "uri", ",", "'w'", ")", ";", "if", "(", "!", "$", "this", "->", "handle", ")", "{", "return", "false", ";", "}", "else", "{", "retu...
{@inheritdoc}
[ "{" ]
train
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/src/Source/Writer/TSV.php#L37-L45
ripaclub/zf2-sphinxsearch-tool
src/Source/Writer/TSV.php
TSV.addDocument
public function addDocument(array $doc) { if (!isset($doc['id'])) { throw new NotValidDocumentException('Document array must have an element with "id" key'); } ob_start(); $len = fputcsv($this->handle, $doc, "\t"); if ($len === false) { throw new \Runt...
php
public function addDocument(array $doc) { if (!isset($doc['id'])) { throw new NotValidDocumentException('Document array must have an element with "id" key'); } ob_start(); $len = fputcsv($this->handle, $doc, "\t"); if ($len === false) { throw new \Runt...
[ "public", "function", "addDocument", "(", "array", "$", "doc", ")", "{", "if", "(", "!", "isset", "(", "$", "doc", "[", "'id'", "]", ")", ")", "{", "throw", "new", "NotValidDocumentException", "(", "'Document array must have an element with \"id\" key'", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/ripaclub/zf2-sphinxsearch-tool/blob/4cb51341ccf1db9942e3e578855a579afd608d69/src/Source/Writer/TSV.php#L58-L69
PeekAndPoke/psi
src/Operation/Terminal/MinOperation.php
MinOperation.apply
public function apply(\Iterator $set) { $data = iterator_to_array($set); return count($data) > 0 ? min($data) : 0; }
php
public function apply(\Iterator $set) { $data = iterator_to_array($set); return count($data) > 0 ? min($data) : 0; }
[ "public", "function", "apply", "(", "\\", "Iterator", "$", "set", ")", "{", "$", "data", "=", "iterator_to_array", "(", "$", "set", ")", ";", "return", "count", "(", "$", "data", ")", ">", "0", "?", "min", "(", "$", "data", ")", ":", "0", ";", ...
{@inheritdoc} @return float
[ "{", "@inheritdoc", "}" ]
train
https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/Terminal/MinOperation.php#L24-L29
spiral-modules/auth
source/Auth/Operators/PersistentOperator.php
PersistentOperator.createToken
public function createToken(UserInterface $user): TokenInterface { return $this->source->createToken($user, $this->lifetime)->withOperator($this); }
php
public function createToken(UserInterface $user): TokenInterface { return $this->source->createToken($user, $this->lifetime)->withOperator($this); }
[ "public", "function", "createToken", "(", "UserInterface", "$", "user", ")", ":", "TokenInterface", "{", "return", "$", "this", "->", "source", "->", "createToken", "(", "$", "user", ",", "$", "this", "->", "lifetime", ")", "->", "withOperator", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/PersistentOperator.php#L68-L71
spiral-modules/auth
source/Auth/Operators/PersistentOperator.php
PersistentOperator.fetchToken
public function fetchToken(Request $request) { if (!$this->hasToken($request)) { return null; } $token = $this->source->findToken($this->bridge->fetchToken($request)); if (empty($token)) { //Token not found or expired return null; } ...
php
public function fetchToken(Request $request) { if (!$this->hasToken($request)) { return null; } $token = $this->source->findToken($this->bridge->fetchToken($request)); if (empty($token)) { //Token not found or expired return null; } ...
[ "public", "function", "fetchToken", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "this", "->", "hasToken", "(", "$", "request", ")", ")", "{", "return", "null", ";", "}", "$", "token", "=", "$", "this", "->", "source", "->", "find...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/PersistentOperator.php#L84-L97
spiral-modules/auth
source/Auth/Operators/PersistentOperator.php
PersistentOperator.commitToken
public function commitToken( Request $request, Response $response, TokenInterface $token ): Response { if ($this->updateTokens) { $this->source->touchToken($token, $this->lifetime); } return $this->bridge->writeToken($request, $response, $this->lifetime, ...
php
public function commitToken( Request $request, Response $response, TokenInterface $token ): Response { if ($this->updateTokens) { $this->source->touchToken($token, $this->lifetime); } return $this->bridge->writeToken($request, $response, $this->lifetime, ...
[ "public", "function", "commitToken", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "TokenInterface", "$", "token", ")", ":", "Response", "{", "if", "(", "$", "this", "->", "updateTokens", ")", "{", "$", "this", "->", "source", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/PersistentOperator.php#L102-L112
spiral-modules/auth
source/Auth/Operators/PersistentOperator.php
PersistentOperator.removeToken
public function removeToken( Request $request, Response $response, TokenInterface $token ): Response { $this->source->deleteToken($token); //Reset user token value return $this->bridge->writeToken($request, $response, $this->lifetime, null); }
php
public function removeToken( Request $request, Response $response, TokenInterface $token ): Response { $this->source->deleteToken($token); //Reset user token value return $this->bridge->writeToken($request, $response, $this->lifetime, null); }
[ "public", "function", "removeToken", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "TokenInterface", "$", "token", ")", ":", "Response", "{", "$", "this", "->", "source", "->", "deleteToken", "(", "$", "token", ")", ";", "//Reset u...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/PersistentOperator.php#L117-L126
alanpich/slender
src/Core/Autoloader/ClassLoader.php
ClassLoader.registerNamespace
public function registerNamespace($namespace, $paths, $type = 'psr-0') { switch ($type) { case 'psr-0': parent::registerNamespace($namespace, $paths); break; case 'psr-4': $this->psr4Loader->addNamespace($namespace,$paths); ...
php
public function registerNamespace($namespace, $paths, $type = 'psr-0') { switch ($type) { case 'psr-0': parent::registerNamespace($namespace, $paths); break; case 'psr-4': $this->psr4Loader->addNamespace($namespace,$paths); ...
[ "public", "function", "registerNamespace", "(", "$", "namespace", ",", "$", "paths", ",", "$", "type", "=", "'psr-0'", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'psr-0'", ":", "parent", "::", "registerNamespace", "(", "$", "namespace", ","...
Overridden to allow injecting psr-4 into the mix. Also opens up doors for alternative formats to be used later. Either way, it's a mess here right now @param string $namespace @param array|string $paths @param string $type Eith...
[ "Overridden", "to", "allow", "injecting", "psr", "-", "4", "into", "the", "mix", ".", "Also", "opens", "up", "doors", "for", "alternative", "formats", "to", "be", "used", "later", ".", "Either", "way", "it", "s", "a", "mess", "here", "right", "now" ]
train
https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/Autoloader/ClassLoader.php#L56-L68
tigris-php/telegram-bot-api
src/Types/Message.php
Message.detectType
protected static function detectType(array $data) { foreach ([ self::TYPE_TEXT, self::TYPE_AUDIO, self::TYPE_DOCUMENT, self::TYPE_GAME, self::TYPE_PHOTO, self::TYPE_STICKER, ...
php
protected static function detectType(array $data) { foreach ([ self::TYPE_TEXT, self::TYPE_AUDIO, self::TYPE_DOCUMENT, self::TYPE_GAME, self::TYPE_PHOTO, self::TYPE_STICKER, ...
[ "protected", "static", "function", "detectType", "(", "array", "$", "data", ")", "{", "foreach", "(", "[", "self", "::", "TYPE_TEXT", ",", "self", "::", "TYPE_AUDIO", ",", "self", "::", "TYPE_DOCUMENT", ",", "self", "::", "TYPE_GAME", ",", "self", "::", ...
Detects message type @param $data @return string
[ "Detects", "message", "type" ]
train
https://github.com/tigris-php/telegram-bot-api/blob/7350c81d571387005d58079d8c654ee44504cdcf/src/Types/Message.php#L114-L146
tbreuss/pvc
src/Middleware/MiddlewarePipe.php
MiddlewarePipe.add
public function add(MiddlewareInterface $middleware): self { $pipe = clone $this; array_push($pipe->middlewares, $middleware); return $pipe; }
php
public function add(MiddlewareInterface $middleware): self { $pipe = clone $this; array_push($pipe->middlewares, $middleware); return $pipe; }
[ "public", "function", "add", "(", "MiddlewareInterface", "$", "middleware", ")", ":", "self", "{", "$", "pipe", "=", "clone", "$", "this", ";", "array_push", "(", "$", "pipe", "->", "middlewares", ",", "$", "middleware", ")", ";", "return", "$", "pipe", ...
Creates a new pipe with the given middleware connected. @param MiddlewareInterface $middleware @return self
[ "Creates", "a", "new", "pipe", "with", "the", "given", "middleware", "connected", "." ]
train
https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/Middleware/MiddlewarePipe.php#L56-L61
yuncms/framework
src/helpers/NumberHelper.php
NumberHelper.word
public static function word(int $num): string { $numberWordMap = [ 1 => Yii::t('yuncms', 'One'), 2 => Yii::t('yuncms', 'Two'), 3 => Yii::t('yuncms', 'Three'), 4 => Yii::t('yuncms', 'Four'), 5 => Yii::t('yuncms', 'Five'), 6 => Yii::t('yu...
php
public static function word(int $num): string { $numberWordMap = [ 1 => Yii::t('yuncms', 'One'), 2 => Yii::t('yuncms', 'Two'), 3 => Yii::t('yuncms', 'Three'), 4 => Yii::t('yuncms', 'Four'), 5 => Yii::t('yuncms', 'Five'), 6 => Yii::t('yu...
[ "public", "static", "function", "word", "(", "int", "$", "num", ")", ":", "string", "{", "$", "numberWordMap", "=", "[", "1", "=>", "Yii", "::", "t", "(", "'yuncms'", ",", "'One'", ")", ",", "2", "=>", "Yii", "::", "t", "(", "'yuncms'", ",", "'Tw...
Returns the "word" version of a number @param int $num The number @return string The number word, or the original number if it's >= 10
[ "Returns", "the", "word", "version", "of", "a", "number" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L22-L41
yuncms/framework
src/helpers/NumberHelper.php
NumberHelper.upperAlpha
public static function upperAlpha(int $num): string { $num--; $alpha = ''; while ($num >= 0) { $ascii = ($num % 26) + 65; $alpha = chr($ascii) . $alpha; $num = (int)($num / 26) - 1; } return $alpha; }
php
public static function upperAlpha(int $num): string { $num--; $alpha = ''; while ($num >= 0) { $ascii = ($num % 26) + 65; $alpha = chr($ascii) . $alpha; $num = (int)($num / 26) - 1; } return $alpha; }
[ "public", "static", "function", "upperAlpha", "(", "int", "$", "num", ")", ":", "string", "{", "$", "num", "--", ";", "$", "alpha", "=", "''", ";", "while", "(", "$", "num", ">=", "0", ")", "{", "$", "ascii", "=", "(", "$", "num", "%", "26", ...
返回数字的大写字母版本 @param int $num The number @return string The alphabetic version of the number
[ "返回数字的大写字母版本" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L51-L64
yuncms/framework
src/helpers/NumberHelper.php
NumberHelper.lowerAlpha
public static function lowerAlpha(int $num): string { $alpha = static::upperAlpha($num); return StringHelper::toLowerCase($alpha); }
php
public static function lowerAlpha(int $num): string { $alpha = static::upperAlpha($num); return StringHelper::toLowerCase($alpha); }
[ "public", "static", "function", "lowerAlpha", "(", "int", "$", "num", ")", ":", "string", "{", "$", "alpha", "=", "static", "::", "upperAlpha", "(", "$", "num", ")", ";", "return", "StringHelper", "::", "toLowerCase", "(", "$", "alpha", ")", ";", "}" ]
返回数字的小写字母版本 @param int $num The number @return string The alphabetic version of the number
[ "返回数字的小写字母版本" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L73-L78
yuncms/framework
src/helpers/NumberHelper.php
NumberHelper.upperRoman
public static function upperRoman(int $num): string { $roman = ''; $map = [ 'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, ...
php
public static function upperRoman(int $num): string { $roman = ''; $map = [ 'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, ...
[ "public", "static", "function", "upperRoman", "(", "int", "$", "num", ")", ":", "string", "{", "$", "roman", "=", "''", ";", "$", "map", "=", "[", "'M'", "=>", "1000", ",", "'CM'", "=>", "900", ",", "'D'", "=>", "500", ",", "'CD'", "=>", "400", ...
返回数字的大写罗马数字版本 @param int $num The number @return string The roman numeral version of the number
[ "返回数字的大写罗马数字版本" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L87-L115
yuncms/framework
src/helpers/NumberHelper.php
NumberHelper.lowerRoman
public static function lowerRoman(int $num): string { $roman = static::upperRoman($num); return StringHelper::toLowerCase($roman); }
php
public static function lowerRoman(int $num): string { $roman = static::upperRoman($num); return StringHelper::toLowerCase($roman); }
[ "public", "static", "function", "lowerRoman", "(", "int", "$", "num", ")", ":", "string", "{", "$", "roman", "=", "static", "::", "upperRoman", "(", "$", "num", ")", ";", "return", "StringHelper", "::", "toLowerCase", "(", "$", "roman", ")", ";", "}" ]
返回数字的小写罗马数字版本 @param int $num The number @return string The roman numeral version of the number
[ "返回数字的小写罗马数字版本" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L124-L129
2amigos/yiifoundation
widgets/Tooltip.php
Tooltip.init
public function init() { $this->assets = array( 'js' => YII_DEBUG ? 'foundation/foundation.tooltips.js' : 'foundation.min.js' ); Html::addCssClass($this->htmlOptions, Enum::TOOLTIP); Html::addCssClass($this->htmlOptions, $this->position); ArrayHelper::addValue('t...
php
public function init() { $this->assets = array( 'js' => YII_DEBUG ? 'foundation/foundation.tooltips.js' : 'foundation.min.js' ); Html::addCssClass($this->htmlOptions, Enum::TOOLTIP); Html::addCssClass($this->htmlOptions, $this->position); ArrayHelper::addValue('t...
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "assets", "=", "array", "(", "'js'", "=>", "YII_DEBUG", "?", "'foundation/foundation.tooltips.js'", ":", "'foundation.min.js'", ")", ";", "Html", "::", "addCssClass", "(", "$", "this", "->", "ht...
Initializes the widget
[ "Initializes", "the", "widget" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/Tooltip.php#L46-L62
2amigos/yiifoundation
widgets/Tooltip.php
Tooltip.registerClientScript
public function registerClientScript() { if (!empty($this->pluginOptions)) { $options = \CJavaScript::encode($this->pluginOptions); \Yii::app()->clientScript ->registerScript('Tooltip#' . $this->getId(), "$(document).foundation('tooltip', {$options});"); } ...
php
public function registerClientScript() { if (!empty($this->pluginOptions)) { $options = \CJavaScript::encode($this->pluginOptions); \Yii::app()->clientScript ->registerScript('Tooltip#' . $this->getId(), "$(document).foundation('tooltip', {$options});"); } ...
[ "public", "function", "registerClientScript", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "pluginOptions", ")", ")", "{", "$", "options", "=", "\\", "CJavaScript", "::", "encode", "(", "$", "this", "->", "pluginOptions", ")", ";", "...
Registers plugin options and events (if any)
[ "Registers", "plugin", "options", "and", "events", "(", "if", "any", ")" ]
train
https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/Tooltip.php#L84-L91
nodes-php/database
src/Eloquent/Repository.php
Repository.first
public function first($columns = ['*']) { $result = $this->getBuilder()->first($columns); // Reset query builder $this->resetBuilder(); return $result; }
php
public function first($columns = ['*']) { $result = $this->getBuilder()->first($columns); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "first", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "first", "(", "$", "columns", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder"...
Execute the query and get the first result. @author Morten Rugaard <moru@nodes.dk> @param array $columns @return \Illuminate\Database\Eloquent\Model
[ "Execute", "the", "query", "and", "get", "the", "first", "result", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L183-L191
nodes-php/database
src/Eloquent/Repository.php
Repository.firstOrFail
public function firstOrFail($columns = ['*']) { $result = $this->first($columns); if (empty($result)) { throw new EntityNotFoundException(sprintf('First record for table [%s] not found', get_class($this->model))); } return $result; }
php
public function firstOrFail($columns = ['*']) { $result = $this->first($columns); if (empty($result)) { throw new EntityNotFoundException(sprintf('First record for table [%s] not found', get_class($this->model))); } return $result; }
[ "public", "function", "firstOrFail", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "first", "(", "$", "columns", ")", ";", "if", "(", "empty", "(", "$", "result", ")", ")", "{", "throw", "new", "Entit...
Execute the query and get the first result or throw an exception l. @author Morten Rugaard <moru@nodes.dk> @param array $columns @return \Illuminate\Database\Eloquent\Model @throws \Nodes\Database\Exceptions\EntityNotFoundException
[ "Execute", "the", "query", "and", "get", "the", "first", "result", "or", "throw", "an", "exception", "l", ".", "@author", "Morten", "Rugaard", "<moru@nodes", ".", "dk", ">" ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L202-L210
nodes-php/database
src/Eloquent/Repository.php
Repository.get
public function get($columns = ['*']) { $result = $this->getBuilder()->get($columns); // Reset query builder $this->resetBuilder(); return $result; }
php
public function get($columns = ['*']) { $result = $this->getBuilder()->get($columns); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "get", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "get", "(", "$", "columns", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", ...
Execute the query and retrieve result. @author Morten Rugaard <moru@nodes.dk> @param array $columns @return \Illuminate\Database\Eloquent\Collection
[ "Execute", "the", "query", "and", "retrieve", "result", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L220-L228
nodes-php/database
src/Eloquent/Repository.php
Repository.paginate
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) { $result = $this->getBuilder()->paginate($perPage, $columns, $pageName, $page); // Reset query builder $this->resetBuilder(); return $result; }
php
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) { $result = $this->getBuilder()->paginate($perPage, $columns, $pageName, $page); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "paginate", "(", "$", "perPage", "=", "15", ",", "$", "columns", "=", "[", "'*'", "]", ",", "$", "pageName", "=", "'page'", ",", "$", "page", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", "...
Paginate the given query into a simple paginator. @author Morten Rugaard <moru@nodes.dk> @param int $perPage @param array $columns @param string $pageName @param int $page @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
[ "Paginate", "the", "given", "query", "into", "a", "simple", "paginator", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L241-L249
nodes-php/database
src/Eloquent/Repository.php
Repository.simplePaginate
public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page') { $result = $this->getBuilder()->simplePaginate($perPage, $columns, $pageName); // Reset query builder $this->resetBuilder(); return $result; }
php
public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page') { $result = $this->getBuilder()->simplePaginate($perPage, $columns, $pageName); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "simplePaginate", "(", "$", "perPage", "=", "15", ",", "$", "columns", "=", "[", "'*'", "]", ",", "$", "pageName", "=", "'page'", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "simplePaginate", "...
Get a paginator only supporting simple next and previous links. This is more efficient on larger data-sets, etc. @author Morten Rugaard <moru@nodes.dk> @param int $perPage @param array $columns @param string $pageName @return \Illuminate\Contracts\Pagination\Paginator
[ "Get", "a", "paginator", "only", "supporting", "simple", "next", "and", "previous", "links", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L263-L271
nodes-php/database
src/Eloquent/Repository.php
Repository.getCountForPagination
public function getCountForPagination($columns = ['*']) { $result = $this->getBuilder()->getCountForPagination($columns); // Reset query builder $this->resetBuilder(); return $result; }
php
public function getCountForPagination($columns = ['*']) { $result = $this->getBuilder()->getCountForPagination($columns); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "getCountForPagination", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "getCountForPagination", "(", "$", "columns", ")", ";", "// Reset query builder", "$", ...
Get the count of the total records for the paginator. @author Morten Rugaard <moru@nodes.dk> @param array $columns @return int
[ "Get", "the", "count", "of", "the", "total", "records", "for", "the", "paginator", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L281-L289
nodes-php/database
src/Eloquent/Repository.php
Repository.value
public function value($column) { $result = $this->getBuilder()->value($column); // Reset query builder $this->resetBuilder(); return $result; }
php
public function value($column) { $result = $this->getBuilder()->value($column); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "value", "(", "$", "column", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "value", "(", "$", "column", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return...
Get a single column's value from the first result of a query. @author Morten Rugaard <moru@nodes.dk> @param string $column @return mixed
[ "Get", "a", "single", "column", "s", "value", "from", "the", "first", "result", "of", "a", "query", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L299-L307
nodes-php/database
src/Eloquent/Repository.php
Repository.chunk
public function chunk($count, callable $callback) { $result = $this->getBuilder()->chunk($count, $callback); // Reset query builder $this->resetBuilder(); return $result; }
php
public function chunk($count, callable $callback) { $result = $this->getBuilder()->chunk($count, $callback); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "chunk", "(", "$", "count", ",", "callable", "$", "callback", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "chunk", "(", "$", "count", ",", "$", "callback", ")", ";", "// Reset query builder", "$"...
Chunk the results of the query. @author Morten Rugaard <moru@nodes.dk> @param int $count @param callable $callback @return bool
[ "Chunk", "the", "results", "of", "the", "query", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L318-L326
nodes-php/database
src/Eloquent/Repository.php
Repository.each
public function each(callable $callback, $count = 1000) { $result = $this->getBuilder()->each($callback, $count); // Reset query builder $this->resetBuilder(); return $result; }
php
public function each(callable $callback, $count = 1000) { $result = $this->getBuilder()->each($callback, $count); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "each", "(", "callable", "$", "callback", ",", "$", "count", "=", "1000", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "each", "(", "$", "callback", ",", "$", "count", ")", ";", "// Reset query ...
Execute a callback over each item while chunking. @author Morten Rugaard <moru@nodes.dk> @param callable $callback @param int $count @return bool @throws \RuntimeException
[ "Execute", "a", "callback", "over", "each", "item", "while", "chunking", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L338-L346
nodes-php/database
src/Eloquent/Repository.php
Repository.pluck
public function pluck($column, $key = null) { $result = $this->getBuilder()->pluck($column, $key); // Reset query builder $this->resetBuilder(); return $result; }
php
public function pluck($column, $key = null) { $result = $this->getBuilder()->pluck($column, $key); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "pluck", "(", "$", "column", ",", "$", "key", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "pluck", "(", "$", "column", ",", "$", "key", ")", ";", "// Reset query builder", "$", "...
Get an array with the values of a given column. @author Morten Rugaard <moru@nodes.dk> @param string $column @param string $key @return array
[ "Get", "an", "array", "with", "the", "values", "of", "a", "given", "column", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L357-L365
nodes-php/database
src/Eloquent/Repository.php
Repository.implode
public function implode($column, $glue = '') { $result = $this->getBuilder()->implode($column, $glue); // Reset query builder $this->resetBuilder(); return $result; }
php
public function implode($column, $glue = '') { $result = $this->getBuilder()->implode($column, $glue); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "implode", "(", "$", "column", ",", "$", "glue", "=", "''", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "implode", "(", "$", "column", ",", "$", "glue", ")", ";", "// Reset query builder", "$",...
Concatenate values of a given column as a string. @author Morten Rugaard <moru@nodes.dk> @param string $column @param string $glue @return string
[ "Concatenate", "values", "of", "a", "given", "column", "as", "a", "string", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L390-L398
nodes-php/database
src/Eloquent/Repository.php
Repository.count
public function count($columns = '*') { $result = $this->getBuilder()->count($columns); // Reset query builder $this->resetBuilder(); return (int) $result; }
php
public function count($columns = '*') { $result = $this->getBuilder()->count($columns); // Reset query builder $this->resetBuilder(); return (int) $result; }
[ "public", "function", "count", "(", "$", "columns", "=", "'*'", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "count", "(", "$", "columns", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")"...
Execute query as a count statement. @author Morten Rugaard <moru@nodes.dk> @param string $columns @return int
[ "Execute", "query", "as", "a", "count", "statement", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L425-L433
nodes-php/database
src/Eloquent/Repository.php
Repository.min
public function min($column) { $result = $this->getBuilder()->min($column); // Reset query builder $this->resetBuilder(); return $result; }
php
public function min($column) { $result = $this->getBuilder()->min($column); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "min", "(", "$", "column", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "min", "(", "$", "column", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return", ...
Retrieve the minimum value of a given column. @author Morten Rugaard <moru@nodes.dk> @param string $column @return float|int
[ "Retrieve", "the", "minimum", "value", "of", "a", "given", "column", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L443-L451
nodes-php/database
src/Eloquent/Repository.php
Repository.max
public function max($column) { $result = $this->getBuilder()->max($column); // Reset query builder $this->resetBuilder(); return $result; }
php
public function max($column) { $result = $this->getBuilder()->max($column); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "max", "(", "$", "column", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "max", "(", "$", "column", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return", ...
Retrieve the maximum value of a given column. @author Morten Rugaard <moru@nodes.dk> @param string $column @return float|int
[ "Retrieve", "the", "maximum", "value", "of", "a", "given", "column", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L461-L469
nodes-php/database
src/Eloquent/Repository.php
Repository.sum
public function sum($column) { $result = $this->getBuilder()->sum($column); // Reset query builder $this->resetBuilder(); return $result ?: 0; }
php
public function sum($column) { $result = $this->getBuilder()->sum($column); // Reset query builder $this->resetBuilder(); return $result ?: 0; }
[ "public", "function", "sum", "(", "$", "column", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "sum", "(", "$", "column", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return", ...
Retrieve the sum of the values of a given column. @author Morten Rugaard <moru@nodes.dk> @param string $column @return float|int
[ "Retrieve", "the", "sum", "of", "the", "values", "of", "a", "given", "column", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L479-L487
nodes-php/database
src/Eloquent/Repository.php
Repository.avg
public function avg($column) { $result = $this->getBuilder()->avg($column); // Reset query builder $this->resetBuilder(); return $result; }
php
public function avg($column) { $result = $this->getBuilder()->avg($column); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "avg", "(", "$", "column", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "avg", "(", "$", "column", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return", ...
Retrieve the average of the values of a given column. @author Morten Rugaard <moru@nodes.dk> @param string $column @return float|int
[ "Retrieve", "the", "average", "of", "the", "values", "of", "a", "given", "column", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L497-L505
nodes-php/database
src/Eloquent/Repository.php
Repository.aggregate
public function aggregate($function, $columns = ['*']) { $result = $this->getBuilder()->aggregate($function, $columns); // Reset query builder $this->resetBuilder(); return $result; }
php
public function aggregate($function, $columns = ['*']) { $result = $this->getBuilder()->aggregate($function, $columns); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "aggregate", "(", "$", "function", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "aggregate", "(", "$", "function", ",", "$", "columns", ")", ";", "//...
Execute an aggregate function on the database. @author Morten Rugaard <moru@nodes.dk> @param string $function @param array $columns @return float|int
[ "Execute", "an", "aggregate", "function", "on", "the", "database", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L529-L537
nodes-php/database
src/Eloquent/Repository.php
Repository.insert
public function insert(array $values) { $result = $this->getBuilder()->insert($values); // Reset query builder $this->resetBuilder(); return $result; }
php
public function insert(array $values) { $result = $this->getBuilder()->insert($values); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "insert", "(", "array", "$", "values", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "insert", "(", "$", "values", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", "...
Insert a new record into the database. @author Morten Rugaard <moru@nodes.dk> @param array $values @return bool
[ "Insert", "a", "new", "record", "into", "the", "database", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L547-L555
nodes-php/database
src/Eloquent/Repository.php
Repository.insertGetId
public function insertGetId(array $values, $sequence = null) { $result = $this->getBuilder()->insertGetId($values, $sequence); // Reset query builder $this->resetBuilder(); return $result; }
php
public function insertGetId(array $values, $sequence = null) { $result = $this->getBuilder()->insertGetId($values, $sequence); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "insertGetId", "(", "array", "$", "values", ",", "$", "sequence", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "insertGetId", "(", "$", "values", ",", "$", "sequence", ")", ";", "//...
Insert a new record and get the value of the primary key. @author Morten Rugaard <moru@nodes.dk> @param array $values @param string $sequence @return int
[ "Insert", "a", "new", "record", "and", "get", "the", "value", "of", "the", "primary", "key", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L566-L574
nodes-php/database
src/Eloquent/Repository.php
Repository.update
public function update(array $values) { $result = $this->getBuilder()->update($values); // Reset query builder $this->resetBuilder(); return (int) $result; }
php
public function update(array $values) { $result = $this->getBuilder()->update($values); // Reset query builder $this->resetBuilder(); return (int) $result; }
[ "public", "function", "update", "(", "array", "$", "values", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "update", "(", "$", "values", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", "...
Execute query as an update statement. @author Morten Rugaard <moru@nodes.dk> @param array $values @return int
[ "Execute", "query", "as", "an", "update", "statement", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L584-L592
nodes-php/database
src/Eloquent/Repository.php
Repository.increment
public function increment($column, $amount = 1, array $extra = []) { $result = $this->getBuilder()->increment($column, $amount, $extra); // Reset query builder $this->resetBuilder(); return (int) $result; }
php
public function increment($column, $amount = 1, array $extra = []) { $result = $this->getBuilder()->increment($column, $amount, $extra); // Reset query builder $this->resetBuilder(); return (int) $result; }
[ "public", "function", "increment", "(", "$", "column", ",", "$", "amount", "=", "1", ",", "array", "$", "extra", "=", "[", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "increment", "(", "$", "column", ",", "...
Increment a column's value by a given amount. @author Morten Rugaard <moru@nodes.dk> @param string $column @param int $amount @param array $extra @return int
[ "Increment", "a", "column", "s", "value", "by", "a", "given", "amount", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L638-L646
nodes-php/database
src/Eloquent/Repository.php
Repository.raw
public function raw($value) { $result = $this->getBuilder()->raw($value); // Reset query builder $this->resetBuilder(); return $result; }
php
public function raw($value) { $result = $this->getBuilder()->raw($value); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "raw", "(", "$", "value", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "raw", "(", "$", "value", ")", ";", "// Reset query builder", "$", "this", "->", "resetBuilder", "(", ")", ";", "return", "...
Create a raw database expression. @author Morten Rugaard <moru@nodes.dk> @param mixed $value @return \Illuminate\Database\Query\Expression
[ "Create", "a", "raw", "database", "expression", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L691-L699
nodes-php/database
src/Eloquent/Repository.php
Repository.renderSql
public function renderSql() { $result = vsprintf( $this->getBuilder()->getQuery()->toSql(), $this->getBuilder()->getQuery()->getBindings() ); // Reset query builder $this->resetBuilder(); return $result; }
php
public function renderSql() { $result = vsprintf( $this->getBuilder()->getQuery()->toSql(), $this->getBuilder()->getQuery()->getBindings() ); // Reset query builder $this->resetBuilder(); return $result; }
[ "public", "function", "renderSql", "(", ")", "{", "$", "result", "=", "vsprintf", "(", "$", "this", "->", "getBuilder", "(", ")", "->", "getQuery", "(", ")", "->", "toSql", "(", ")", ",", "$", "this", "->", "getBuilder", "(", ")", "->", "getQuery", ...
Render repository's query SQL string. @author Morten Rugaard <moru@nodes.dk> @return string
[ "Render", "repository", "s", "query", "SQL", "string", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L725-L736
nodes-php/database
src/Eloquent/Repository.php
Repository.withTrashed
public function withTrashed() { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait'); } // Set repository builder to inc...
php
public function withTrashed() { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait'); } // Set repository builder to inc...
[ "public", "function", "withTrashed", "(", ")", "{", "// Validate model is soft deletable", "if", "(", "!", "in_array", "(", "IlluminateEloquentSoftDeletes", "::", "class", ",", "class_uses", "(", "$", "this", "->", "getModel", "(", ")", ")", ")", ")", "{", "th...
Include soft deleted entries in query. Note this will reset the build @author Morten Rugaard <moru@nodes.dk> @throws \Nodes\Database\Exceptions\ModelNotSoftDeletable
[ "Include", "soft", "deleted", "entries", "in", "query", ".", "Note", "this", "will", "reset", "the", "build" ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L746-L757
nodes-php/database
src/Eloquent/Repository.php
Repository.onlyTrashed
public function onlyTrashed() { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait'); } // Set repository builder to inc...
php
public function onlyTrashed() { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait'); } // Set repository builder to inc...
[ "public", "function", "onlyTrashed", "(", ")", "{", "// Validate model is soft deletable", "if", "(", "!", "in_array", "(", "IlluminateEloquentSoftDeletes", "::", "class", ",", "class_uses", "(", "$", "this", "->", "getModel", "(", ")", ")", ")", ")", "{", "th...
Only include soft deleted entries in query. Note this will reset the build @author Morten Rugaard <moru@nodes.dk> @return $this @throws \Nodes\Database\Exceptions\ModelNotSoftDeletable
[ "Only", "include", "soft", "deleted", "entries", "in", "query", ".", "Note", "this", "will", "reset", "the", "build" ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L768-L779
nodes-php/database
src/Eloquent/Repository.php
Repository.find
public function find($id, array $columns = ['*']) { if (is_array($id)) { return $this->findMany($id, $columns); } return $this->getBy($this->getModel()->getQualifiedKeyName(), $id, $columns); }
php
public function find($id, array $columns = ['*']) { if (is_array($id)) { return $this->findMany($id, $columns); } return $this->getBy($this->getModel()->getQualifiedKeyName(), $id, $columns); }
[ "public", "function", "find", "(", "$", "id", ",", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "is_array", "(", "$", "id", ")", ")", "{", "return", "$", "this", "->", "findMany", "(", "$", "id", ",", "$", "columns", ")",...
Find a model by its primary key. @author Morten Rugaard <moru@nodes.dk> @param mixed $id @param array $columns @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null
[ "Find", "a", "model", "by", "its", "primary", "key", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L790-L797
nodes-php/database
src/Eloquent/Repository.php
Repository.findMany
public function findMany($ids, array $columns = ['*']) { if (empty($ids)) { return $this->model->newCollection(); } $this->getBuilder()->whereIn($this->getModel()->getQualifiedKeyName(), $ids); return $this->get($columns); }
php
public function findMany($ids, array $columns = ['*']) { if (empty($ids)) { return $this->model->newCollection(); } $this->getBuilder()->whereIn($this->getModel()->getQualifiedKeyName(), $ids); return $this->get($columns); }
[ "public", "function", "findMany", "(", "$", "ids", ",", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "if", "(", "empty", "(", "$", "ids", ")", ")", "{", "return", "$", "this", "->", "model", "->", "newCollection", "(", ")", ";", "}", ...
Find a model by its primary key. @author Morten Rugaard <moru@nodes.dk> @param array $ids @param array $columns @return \Illuminate\Database\Eloquent\Collection
[ "Find", "a", "model", "by", "its", "primary", "key", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L808-L817
nodes-php/database
src/Eloquent/Repository.php
Repository.findOrFail
public function findOrFail($id, $columns = ['*']) { $result = $this->find($id, $columns); if (is_array($id)) { if (count($result) == count(array_unique($id))) { return $result; } } elseif (! is_null($result)) { return $result; } ...
php
public function findOrFail($id, $columns = ['*']) { $result = $this->find($id, $columns); if (is_array($id)) { if (count($result) == count(array_unique($id))) { return $result; } } elseif (! is_null($result)) { return $result; } ...
[ "public", "function", "findOrFail", "(", "$", "id", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "find", "(", "$", "id", ",", "$", "columns", ")", ";", "if", "(", "is_array", "(", "$", "id", ")", ...
Find a model by its primary key or throw an exception. @author Morten Rugaard <moru@nodes.dk> @param mixed $id @param array $columns @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection @throws \Nodes\Database\Exceptions\EntityNotFoundException
[ "Find", "a", "model", "by", "its", "primary", "key", "or", "throw", "an", "exception", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L829-L842
nodes-php/database
src/Eloquent/Repository.php
Repository.getBy
public function getBy($column, $value, array $columns = ['*']) { $result = $this->getBuilder() ->select($columns) ->where($column, '=', $value) ->first(); // Reset query builder $this->resetBuilder(); return $resu...
php
public function getBy($column, $value, array $columns = ['*']) { $result = $this->getBuilder() ->select($columns) ->where($column, '=', $value) ->first(); // Reset query builder $this->resetBuilder(); return $resu...
[ "public", "function", "getBy", "(", "$", "column", ",", "$", "value", ",", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "result", "=", "$", "this", "->", "getBuilder", "(", ")", "->", "select", "(", "$", "columns", ")", "->", "wh...
Retrieve entity by a specific column and value. @author Morten Rugaard <moru@nodes.dk> @param string $column @param string|int $value @param array $columns @return \Illuminate\Database\Eloquent\Model
[ "Retrieve", "entity", "by", "a", "specific", "column", "and", "value", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L854-L865
nodes-php/database
src/Eloquent/Repository.php
Repository.getByOrFail
public function getByOrFail($column, $value, array $columns = ['*']) { $entity = $this->getBy($column, $value, $columns); if (empty($entity)) { throw new EntityNotFoundException(sprintf('%s not found for column [%s] with value [%s]', get_class($this->getModel()), $column,...
php
public function getByOrFail($column, $value, array $columns = ['*']) { $entity = $this->getBy($column, $value, $columns); if (empty($entity)) { throw new EntityNotFoundException(sprintf('%s not found for column [%s] with value [%s]', get_class($this->getModel()), $column,...
[ "public", "function", "getByOrFail", "(", "$", "column", ",", "$", "value", ",", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "entity", "=", "$", "this", "->", "getBy", "(", "$", "column", ",", "$", "value", ",", "$", "columns", ...
Retrieve entity by a specific column and value. If entity is not found, we'll throw an exception @author Morten Rugaard <moru@nodes.dk> @param string $column @param string|int $value @param array $columns @return \Illuminate\Database\Eloquent\Model @throws \Nodes\Database\Exceptions\EntityNotFoun...
[ "Retrieve", "entity", "by", "a", "specific", "column", "and", "value", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L880-L889
nodes-php/database
src/Eloquent/Repository.php
Repository.getByContinuously
public function getByContinuously($column, $value, array $columns = ['*'], $retries = 10, $delayMs = 100, $maxDelay = 2000, $maxRetries = 100) { // Hard limits $maxDelay = ($maxDelay > 2000) ? 2000 : $maxDelay; $maxRetries = ($maxRetries > 100) ? 100 : $maxRetries; // Validate delay...
php
public function getByContinuously($column, $value, array $columns = ['*'], $retries = 10, $delayMs = 100, $maxDelay = 2000, $maxRetries = 100) { // Hard limits $maxDelay = ($maxDelay > 2000) ? 2000 : $maxDelay; $maxRetries = ($maxRetries > 100) ? 100 : $maxRetries; // Validate delay...
[ "public", "function", "getByContinuously", "(", "$", "column", ",", "$", "value", ",", "array", "$", "columns", "=", "[", "'*'", "]", ",", "$", "retries", "=", "10", ",", "$", "delayMs", "=", "100", ",", "$", "maxDelay", "=", "2000", ",", "$", "max...
Retrieve entity by a specific column and value. Will retry with a delay until found. Should only be used in queues, where databases are in a cluster and there's a chance it's not always in sync @author Casper Rasmussen <cr@nodes.dk> @param string $column @param string $value @param array $columns @param int ...
[ "Retrieve", "entity", "by", "a", "specific", "column", "and", "value", ".", "Will", "retry", "with", "a", "delay", "until", "found", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L975-L1003
nodes-php/database
src/Eloquent/Repository.php
Repository.getByIdContinuously
public function getByIdContinuously($id, array $columns = ['*'], $retries = 10, $delayMs = 100) { return $this->getByContinuously('id', $id, $columns, $retries, $delayMs); }
php
public function getByIdContinuously($id, array $columns = ['*'], $retries = 10, $delayMs = 100) { return $this->getByContinuously('id', $id, $columns, $retries, $delayMs); }
[ "public", "function", "getByIdContinuously", "(", "$", "id", ",", "array", "$", "columns", "=", "[", "'*'", "]", ",", "$", "retries", "=", "10", ",", "$", "delayMs", "=", "100", ")", "{", "return", "$", "this", "->", "getByContinuously", "(", "'id'", ...
Retrieve entity by ID. Will retry with a delay until found. Should only be used in queues, where databases are in a cluster and there's a chance it's not always in sync @author Casper Rasmussen <cr@nodes.dk> @param int $id @param array $columns @param int $retries @param int $delayMs @return \Illuminate\Databa...
[ "Retrieve", "entity", "by", "ID", ".", "Will", "retry", "with", "a", "delay", "until", "found", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1020-L1023
nodes-php/database
src/Eloquent/Repository.php
Repository.getByIdContinuouslyOrFail
public function getByIdContinuouslyOrFail($id, array $columns = ['*'], $retries = 10, $delayMs = 100) { $result = $this->getByContinuously('id', $id, $columns, $retries, $delayMs); if (empty($result)) { throw new EntityNotFoundException(sprintf('%s not found continuously by Id with value...
php
public function getByIdContinuouslyOrFail($id, array $columns = ['*'], $retries = 10, $delayMs = 100) { $result = $this->getByContinuously('id', $id, $columns, $retries, $delayMs); if (empty($result)) { throw new EntityNotFoundException(sprintf('%s not found continuously by Id with value...
[ "public", "function", "getByIdContinuouslyOrFail", "(", "$", "id", ",", "array", "$", "columns", "=", "[", "'*'", "]", ",", "$", "retries", "=", "10", ",", "$", "delayMs", "=", "100", ")", "{", "$", "result", "=", "$", "this", "->", "getByContinuously"...
Retrieve entity by ID. Will retry with a delay until found or throw an exception. Should only be used in queues, where databases are in a cluster and there's a chance it's not always in sync @author Rasmus Ebbesen <re@nodes.dk> @param int $id @param array $columns @param int $retries @param int $delayMs @retur...
[ "Retrieve", "entity", "by", "ID", ".", "Will", "retry", "with", "a", "delay", "until", "found", "or", "throw", "an", "exception", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1040-L1049
nodes-php/database
src/Eloquent/Repository.php
Repository.deleteMorphsByEntity
public function deleteMorphsByEntity(IlluminateEloquentModel $entity, $relationName, $forceDelete = false) { // Retrieve all records by entity type and entity ID $entities = $this->getBuilder() ->select(['id']) ->where(function ($query) use ($entity,...
php
public function deleteMorphsByEntity(IlluminateEloquentModel $entity, $relationName, $forceDelete = false) { // Retrieve all records by entity type and entity ID $entities = $this->getBuilder() ->select(['id']) ->where(function ($query) use ($entity,...
[ "public", "function", "deleteMorphsByEntity", "(", "IlluminateEloquentModel", "$", "entity", ",", "$", "relationName", ",", "$", "forceDelete", "=", "false", ")", "{", "// Retrieve all records by entity type and entity ID", "$", "entities", "=", "$", "this", "->", "ge...
Delete morphed relations by entity. Note: This should only be used with morphed relations @author Morten Rugaard <moru@nodes.dk> @param \Illuminate\Database\Eloquent\Model $entity @param string $relationName @param bool $forceDelete @return int
[ "Delete", "morphed", "relations", "by", "entity", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1063-L1090
nodes-php/database
src/Eloquent/Repository.php
Repository.restoreMorphsByEntity
public function restoreMorphsByEntity(IlluminateEloquentModel $entity, $relationName) { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trai...
php
public function restoreMorphsByEntity(IlluminateEloquentModel $entity, $relationName) { // Validate model is soft deletable if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) { throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trai...
[ "public", "function", "restoreMorphsByEntity", "(", "IlluminateEloquentModel", "$", "entity", ",", "$", "relationName", ")", "{", "// Validate model is soft deletable", "if", "(", "!", "in_array", "(", "IlluminateEloquentSoftDeletes", "::", "class", ",", "class_uses", "...
Restore morphed relations by entity. Note: This should only be used with morphed relations @author Morten Rugaard <moru@nodes.dk> @param \Illuminate\Database\Eloquent\Model $entity @param string $relationName @return int @throws \Nodes\Database\Exceptions\ModelNotSoftDeletable
[ "Restore", "morphed", "relations", "by", "entity", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1104-L1136
nodes-php/database
src/Eloquent/Repository.php
Repository.setModel
public function setModel(IlluminateEloquentModel $model) { // Set repository model $this->model = $model; // Set repository builder from model $this->setBuilder($model->newQuery()); return $this; }
php
public function setModel(IlluminateEloquentModel $model) { // Set repository model $this->model = $model; // Set repository builder from model $this->setBuilder($model->newQuery()); return $this; }
[ "public", "function", "setModel", "(", "IlluminateEloquentModel", "$", "model", ")", "{", "// Set repository model", "$", "this", "->", "model", "=", "$", "model", ";", "// Set repository builder from model", "$", "this", "->", "setBuilder", "(", "$", "model", "->...
Set repository model. @author Morten Rugaard <moru@nodes.dk> @param \Illuminate\Database\Eloquent\Model $model @return $this
[ "Set", "repository", "model", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1182-L1191
nodes-php/database
src/Eloquent/Repository.php
Repository.setBuilder
public function setBuilder(IlluminateEloquentBuilder $builder = null) { // If no builder was provided, // we'll use the one from this repositorys model if (empty($builder)) { $builder = $this->getModel()->newQuery(); } // Set repository builder $this->bui...
php
public function setBuilder(IlluminateEloquentBuilder $builder = null) { // If no builder was provided, // we'll use the one from this repositorys model if (empty($builder)) { $builder = $this->getModel()->newQuery(); } // Set repository builder $this->bui...
[ "public", "function", "setBuilder", "(", "IlluminateEloquentBuilder", "$", "builder", "=", "null", ")", "{", "// If no builder was provided,", "// we'll use the one from this repositorys model", "if", "(", "empty", "(", "$", "builder", ")", ")", "{", "$", "builder", "...
Set repository builder. @author Morten Rugaard <moru@nodes.dk> @acecss public @param \Illuminate\Database\Eloquent\Builder $builder @return $this
[ "Set", "repository", "builder", "." ]
train
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1214-L1226
askupasoftware/amarkal
Assets/Script.php
Script.register
public function register() { wp_register_script( $this->handle, $this->url, $this->dependencies, $this->version, $this->footer ); // Localize the script as needed if( !empty( $this->localize['data'] ) && !empty( $this->loca...
php
public function register() { wp_register_script( $this->handle, $this->url, $this->dependencies, $this->version, $this->footer ); // Localize the script as needed if( !empty( $this->localize['data'] ) && !empty( $this->loca...
[ "public", "function", "register", "(", ")", "{", "wp_register_script", "(", "$", "this", "->", "handle", ",", "$", "this", "->", "url", ",", "$", "this", "->", "dependencies", ",", "$", "this", "->", "version", ",", "$", "this", "->", "footer", ")", ...
Enqueue the script and localize the data as needed
[ "Enqueue", "the", "script", "and", "localize", "the", "data", "as", "needed" ]
train
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Assets/Script.php#L39-L58
mremi/Flowdock
src/Mremi/Flowdock/Api/Push/BaseMessage.php
BaseMessage.setTags
public function setTags(array $tags) { $this->clearTags(); foreach ($tags as $tag) { $this->addTag($tag); } return $this; }
php
public function setTags(array $tags) { $this->clearTags(); foreach ($tags as $tag) { $this->addTag($tag); } return $this; }
[ "public", "function", "setTags", "(", "array", "$", "tags", ")", "{", "$", "this", "->", "clearTags", "(", ")", ";", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", "$", "this", "->", "addTag", "(", "$", "tag", ")", ";", "}", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/BaseMessage.php#L77-L86
mremi/Flowdock
src/Mremi/Flowdock/Api/Push/BaseMessage.php
BaseMessage.toArray
public function toArray() { $array = get_object_vars($this); $keys = array_map(array($this, 'underscore'), array_keys($array)); return array_combine($keys, array_values($array)); }
php
public function toArray() { $array = get_object_vars($this); $keys = array_map(array($this, 'underscore'), array_keys($array)); return array_combine($keys, array_values($array)); }
[ "public", "function", "toArray", "(", ")", "{", "$", "array", "=", "get_object_vars", "(", "$", "this", ")", ";", "$", "keys", "=", "array_map", "(", "array", "(", "$", "this", ",", "'underscore'", ")", ",", "array_keys", "(", "$", "array", ")", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/BaseMessage.php#L140-L147
mremi/Flowdock
src/Mremi/Flowdock/Api/Push/BaseMessage.php
BaseMessage.getResponseBody
public function getResponseBody() { if (null === $this->response) { return array(); } $body = json_decode($this->response->getBody(true), true); return is_array($body) ? $body : array(); }
php
public function getResponseBody() { if (null === $this->response) { return array(); } $body = json_decode($this->response->getBody(true), true); return is_array($body) ? $body : array(); }
[ "public", "function", "getResponseBody", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "response", ")", "{", "return", "array", "(", ")", ";", "}", "$", "body", "=", "json_decode", "(", "$", "this", "->", "response", "->", "getBody", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/BaseMessage.php#L152-L161