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
cohesion/cohesion-core
src/Config/Config.php
Config.get
public function get($name = null) { $data = $this->data; if ($name) { $names = explode('.', $name); if ($names) { foreach ($names as $name) { if (is_array($data) && array_key_exists($name, $data)) { $data = $data[$name];...
php
public function get($name = null) { $data = $this->data; if ($name) { $names = explode('.', $name); if ($names) { foreach ($names as $name) { if (is_array($data) && array_key_exists($name, $data)) { $data = $data[$name];...
[ "public", "function", "get", "(", "$", "name", "=", "null", ")", "{", "$", "data", "=", "$", "this", "->", "data", ";", "if", "(", "$", "name", ")", "{", "$", "names", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "if", "(", "$", ...
Get the value for a key with the given name Can use dot notation for acessing nested keys Example: $config->get('database') will return an associative array of all the database values $config->get('database.host') will return the value for 'host' within the array stored at key 'database'
[ "Get", "the", "value", "for", "a", "key", "with", "the", "given", "name", "Can", "use", "dot", "notation", "for", "acessing", "nested", "keys" ]
train
https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Config/Config.php#L100-L115
cohesion/cohesion-core
src/Config/Config.php
Config.getConfig
public function getConfig($name) { $data = $this->get($name); if ($data === null) { return null; } if (isset($this->data['global'])) { $data['global'] = $this->data['global']; } $config = new self(); $config->load($data); return $co...
php
public function getConfig($name) { $data = $this->get($name); if ($data === null) { return null; } if (isset($this->data['global'])) { $data['global'] = $this->data['global']; } $config = new self(); $config->load($data); return $co...
[ "public", "function", "getConfig", "(", "$", "name", ")", "{", "$", "data", "=", "$", "this", "->", "get", "(", "$", "name", ")", ";", "if", "(", "$", "data", "===", "null", ")", "{", "return", "null", ";", "}", "if", "(", "isset", "(", "$", ...
Get the value at the given key and return it as a config object
[ "Get", "the", "value", "at", "the", "given", "key", "and", "return", "it", "as", "a", "config", "object" ]
train
https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Config/Config.php#L120-L131
cohesion/cohesion-core
src/Config/Config.php
Config.set
public function set($name, $value) { $data = array(); $dataPointer = &$data; $parents = explode('.', $name); $name = array_pop($parents); foreach ($parents as $parent) { $dataPointer[$parent] = array(); $dataPointer = &$dataPointer[$parent]; } ...
php
public function set($name, $value) { $data = array(); $dataPointer = &$data; $parents = explode('.', $name); $name = array_pop($parents); foreach ($parents as $parent) { $dataPointer[$parent] = array(); $dataPointer = &$dataPointer[$parent]; } ...
[ "public", "function", "set", "(", "$", "name", ",", "$", "value", ")", "{", "$", "data", "=", "array", "(", ")", ";", "$", "dataPointer", "=", "&", "$", "data", ";", "$", "parents", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", ...
Set a value in the config. If the value doesn't exist it will be created.
[ "Set", "a", "value", "in", "the", "config", ".", "If", "the", "value", "doesn", "t", "exist", "it", "will", "be", "created", "." ]
train
https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Config/Config.php#L136-L147
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.createSOAPRequest
public function createSOAPRequest() { $this->soapRequest = new SoapRequest(); if (isset($this->options['debugStatus']) && $this->options['debugStatus'] === TRUE) { $this->soapRequest->debugStatus = TRUE; if (isset($this->options['debugLevel']) && !empty($this->options['debugL...
php
public function createSOAPRequest() { $this->soapRequest = new SoapRequest(); if (isset($this->options['debugStatus']) && $this->options['debugStatus'] === TRUE) { $this->soapRequest->debugStatus = TRUE; if (isset($this->options['debugLevel']) && !empty($this->options['debugL...
[ "public", "function", "createSOAPRequest", "(", ")", "{", "$", "this", "->", "soapRequest", "=", "new", "SoapRequest", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "options", "[", "'debugStatus'", "]", ")", "&&", "$", "this", "->", "optio...
Function createSOAPRequest @author: 713uk13m <dev@nguyenanhung.com> @time : 11/10/18 11:36 @return \nguyenanhung\MyRequests\SoapRequest|object
[ "Function", "createSOAPRequest" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L147-L163
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.setSdkConfig
public function setSdkConfig($sdkConfig = NULL) { $this->sdkConfig = $sdkConfig; $this->logger->debug(__FUNCTION__, 'Config Data: ' . json_encode($this->sdkConfig)); if (empty($this->sdkConfig) || !is_array($this->sdkConfig)) { $this->error = TRUE; $this->logger->erro...
php
public function setSdkConfig($sdkConfig = NULL) { $this->sdkConfig = $sdkConfig; $this->logger->debug(__FUNCTION__, 'Config Data: ' . json_encode($this->sdkConfig)); if (empty($this->sdkConfig) || !is_array($this->sdkConfig)) { $this->error = TRUE; $this->logger->erro...
[ "public", "function", "setSdkConfig", "(", "$", "sdkConfig", "=", "NULL", ")", "{", "$", "this", "->", "sdkConfig", "=", "$", "sdkConfig", ";", "$", "this", "->", "logger", "->", "debug", "(", "__FUNCTION__", ",", "'Config Data: '", ".", "json_encode", "("...
Cấu hình Config Data @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 15:33 @param array|null $sdkConfig @return $this
[ "Cấu", "hình", "Config", "Data" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L175-L185
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.setResponseIsObject
public function setResponseIsObject($responseIsObject = FALSE) { $this->responseIsObject = $responseIsObject; $this->logger->error(__FUNCTION__, 'Response Is Object: ' . $this->responseIsObject); return $this; }
php
public function setResponseIsObject($responseIsObject = FALSE) { $this->responseIsObject = $responseIsObject; $this->logger->error(__FUNCTION__, 'Response Is Object: ' . $this->responseIsObject); return $this; }
[ "public", "function", "setResponseIsObject", "(", "$", "responseIsObject", "=", "FALSE", ")", "{", "$", "this", "->", "responseIsObject", "=", "$", "responseIsObject", ";", "$", "this", "->", "logger", "->", "error", "(", "__FUNCTION__", ",", "'Response Is Objec...
Function setResponseIsObject @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 16:35 @param bool $responseIsObject @return $this
[ "Function", "setResponseIsObject" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L210-L216
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.startTransaction
public function startTransaction($transactionId = '') { $this->logger->debug(__FUNCTION__, 'Input Transaction ID: ' . json_encode($transactionId)); if (empty($transactionId)) { $transactionId = date('YmdHis') . rand(100000, 999999); } $this->transactionId = $transactionId...
php
public function startTransaction($transactionId = '') { $this->logger->debug(__FUNCTION__, 'Input Transaction ID: ' . json_encode($transactionId)); if (empty($transactionId)) { $transactionId = date('YmdHis') . rand(100000, 999999); } $this->transactionId = $transactionId...
[ "public", "function", "startTransaction", "(", "$", "transactionId", "=", "''", ")", "{", "$", "this", "->", "logger", "->", "debug", "(", "__FUNCTION__", ",", "'Input Transaction ID: '", ".", "json_encode", "(", "$", "transactionId", ")", ")", ";", "if", "(...
Function startTransaction @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 15:50 @param string $transactionId @return $this
[ "Function", "startTransaction" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L258-L268
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.setSendMtStatus
public function setSendMtStatus($sendMtStatus = TRUE) { $this->sendMtStatus = $sendMtStatus; $this->logger->debug(__FUNCTION__, 'Send MT Status: ' . json_encode($this->sendMtStatus)); return $this; }
php
public function setSendMtStatus($sendMtStatus = TRUE) { $this->sendMtStatus = $sendMtStatus; $this->logger->debug(__FUNCTION__, 'Send MT Status: ' . json_encode($this->sendMtStatus)); return $this; }
[ "public", "function", "setSendMtStatus", "(", "$", "sendMtStatus", "=", "TRUE", ")", "{", "$", "this", "->", "sendMtStatus", "=", "$", "sendMtStatus", ";", "$", "this", "->", "logger", "->", "debug", "(", "__FUNCTION__", ",", "'Send MT Status: '", ".", "json...
Function setSendMtStatus @author: 713uk13m <dev@nguyenanhung.com> @time : 11/18/18 03:11 @param bool $sendMtStatus @return $this
[ "Function", "setSendMtStatus" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L293-L299
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.getMtResult
public function getMtResult() { $this->logger->info(__FUNCTION__, 'Mt Result: ' . json_encode($this->mtResult)); return $this->mtResult; }
php
public function getMtResult() { $this->logger->info(__FUNCTION__, 'Mt Result: ' . json_encode($this->mtResult)); return $this->mtResult; }
[ "public", "function", "getMtResult", "(", ")", "{", "$", "this", "->", "logger", "->", "info", "(", "__FUNCTION__", ",", "'Mt Result: '", ".", "json_encode", "(", "$", "this", "->", "mtResult", ")", ")", ";", "return", "$", "this", "->", "mtResult", ";",...
Trả về kết quả của quá trình trả MT @author: 713uk13m <dev@nguyenanhung.com> @time : 11/10/18 09:19 @return array|null|object Mảng dữ liệu trạng thái gửi MT, biến status == 0 là thành công
[ "Trả", "về", "kết", "quả", "của", "quá", "trình", "trả", "MT" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L389-L394
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.generateMtDataToDb
public function generateMtDataToDb() { if ($this->sendMtStatus === TRUE) { $this->mtDataToDb = array( 'shortcode' => $this->sdkConfig[self::SDP_CONFIG_KEY]['short_code'], 'msisdn' => $this->transactionMsisdn, 'mo' => $this->mtOptions['...
php
public function generateMtDataToDb() { if ($this->sendMtStatus === TRUE) { $this->mtDataToDb = array( 'shortcode' => $this->sdkConfig[self::SDP_CONFIG_KEY]['short_code'], 'msisdn' => $this->transactionMsisdn, 'mo' => $this->mtOptions['...
[ "public", "function", "generateMtDataToDb", "(", ")", "{", "if", "(", "$", "this", "->", "sendMtStatus", "===", "TRUE", ")", "{", "$", "this", "->", "mtDataToDb", "=", "array", "(", "'shortcode'", "=>", "$", "this", "->", "sdkConfig", "[", "self", "::", ...
Hàm tạo dữ liệu Insert DB sau khi gửi MT @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 16:52 @return $this
[ "Hàm", "tạo", "dữ", "liệu", "Insert", "DB", "sau", "khi", "gửi", "MT" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L418-L459
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.insertMtIntoDb
public function insertMtIntoDb() { $this->getMtDataToDb(); $db = $this->connectDatabase($this->sdkConfig[self::SDP_DATABASE_CONFIG_KEY]); $insertId = $db ->setTable(self::TABLE_SMS_LOG . date(self::TABLE_SMS_LOG_SUFFIX)) ->add($this->mtDataToDb); $this->...
php
public function insertMtIntoDb() { $this->getMtDataToDb(); $db = $this->connectDatabase($this->sdkConfig[self::SDP_DATABASE_CONFIG_KEY]); $insertId = $db ->setTable(self::TABLE_SMS_LOG . date(self::TABLE_SMS_LOG_SUFFIX)) ->add($this->mtDataToDb); $this->...
[ "public", "function", "insertMtIntoDb", "(", ")", "{", "$", "this", "->", "getMtDataToDb", "(", ")", ";", "$", "db", "=", "$", "this", "->", "connectDatabase", "(", "$", "this", "->", "sdkConfig", "[", "self", "::", "SDP_DATABASE_CONFIG_KEY", "]", ")", "...
Function insertMtIntoDb @author: 713uk13m <dev@nguyenanhung.com> @time : 11/18/18 02:58 @return int
[ "Function", "insertMtIntoDb" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L469-L480
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.setDataSendMt
public function setDataSendMt($phone_number = '', $message = '', $options = array()) { if (empty($phone_number) || empty($message)) { $this->error = TRUE; $this->mtData = NULL; $this->logger->error(__FUNCTION__, 'Empty Phone Number or MT Message -> ', ['phone_number' => ...
php
public function setDataSendMt($phone_number = '', $message = '', $options = array()) { if (empty($phone_number) || empty($message)) { $this->error = TRUE; $this->mtData = NULL; $this->logger->error(__FUNCTION__, 'Empty Phone Number or MT Message -> ', ['phone_number' => ...
[ "public", "function", "setDataSendMt", "(", "$", "phone_number", "=", "''", ",", "$", "message", "=", "''", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "phone_number", ")", "||", "empty", "(", "$", "message", ...
Hàm cấu hình Data Send MT @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 15:57 @param string $phone_number SDT người nhận @param string $message Nội dung MT gửi đi @param null|array $options Các cấu hình thêm về MO @return $this
[ "Hàm", "cấu", "hình", "Data", "Send", "MT" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L495-L544
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.sendMtUseRestful
public function sendMtUseRestful($timeout = NULL) { if (empty($timeout)) { $timeout = self::REQUEST_TIMEOUT; } if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' =>...
php
public function sendMtUseRestful($timeout = NULL) { if (empty($timeout)) { $timeout = self::REQUEST_TIMEOUT; } if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' =>...
[ "public", "function", "sendMtUseRestful", "(", "$", "timeout", "=", "NULL", ")", "{", "if", "(", "empty", "(", "$", "timeout", ")", ")", "{", "$", "timeout", "=", "self", "::", "REQUEST_TIMEOUT", ";", "}", "if", "(", "empty", "(", "$", "this", "->", ...
Hàm Request Send MT Sử dụng HTTP RESTful Web Service @author: 713uk13m <dev@nguyenanhung.com> @time : 11/9/18 16:57 @param null $timeout Thời gian Timeout của Request @return $this Mảng dữ liệu $this->mtResult trạng thái gửi MT, biến status == 0 là thành công
[ "Hàm", "Request", "Send", "MT", "Sử", "dụng", "HTTP", "RESTful", "Web", "Service" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L556-L665
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.sendMtUseWsdl
public function sendMtUseWsdl() { if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' => 'MT_DATA_IS_EMPTY', 'desc' => 'MT Data is Empty' ); $this->log...
php
public function sendMtUseWsdl() { if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' => 'MT_DATA_IS_EMPTY', 'desc' => 'MT Data is Empty' ); $this->log...
[ "public", "function", "sendMtUseWsdl", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "mtData", ")", ")", "{", "$", "this", "->", "error", "=", "TRUE", ";", "$", "result", "=", "array", "(", "'status'", "=>", "self", "::", "EXIT_CONFIG", ...
Hàm Request Send MT Sử dụng WSDL Web Service @author: 713uk13m <dev@nguyenanhung.com> @time : 11/10/18 11:57 @return $this Mảng dữ liệu $this->mtResult trạng thái gửi MT, biến status == 0 là thành công
[ "Hàm", "Request", "Send", "MT", "Sử", "dụng", "WSDL", "Web", "Service" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L675-L770
nguyenanhung/td-send-sms
src/SendSMS/SendSmsToVnmSDP.php
SendSmsToVnmSDP.sendMtUseSOAP
public function sendMtUseSOAP() { if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' => 'MT_DATA_IS_EMPTY', 'desc' => 'MT Data is Empty' ); $this->log...
php
public function sendMtUseSOAP() { if (empty($this->mtData)) { $this->error = TRUE; $result = array( 'status' => self::EXIT_CONFIG, 'case' => 'MT_DATA_IS_EMPTY', 'desc' => 'MT Data is Empty' ); $this->log...
[ "public", "function", "sendMtUseSOAP", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "mtData", ")", ")", "{", "$", "this", "->", "error", "=", "TRUE", ";", "$", "result", "=", "array", "(", "'status'", "=>", "self", "::", "EXIT_CONFIG", ...
Hàm Request Send MT Sử dụng SOAP Web Service @author: 713uk13m <dev@nguyenanhung.com> @time : 11/10/18 11:56 @return $this Mảng dữ liệu $this->mtResult trạng thái gửi MT, biến status == 0 là thành công
[ "Hàm", "Request", "Send", "MT", "Sử", "dụng", "SOAP", "Web", "Service" ]
train
https://github.com/nguyenanhung/td-send-sms/blob/ed7b413aa09918e0dab3354cbc1d0c4565d39463/src/SendSMS/SendSmsToVnmSDP.php#L780-L875
jfusion/org.jfusion.framework
src/Plugin/Plugin.php
Plugin.getName
final public function getName() { if (!$this->name) { $this->name = get_class($this); list ($jfusion, $plugins, $name) = explode('\\', get_class($this)); $this->name = $name; } return $this->name; }
php
final public function getName() { if (!$this->name) { $this->name = get_class($this); list ($jfusion, $plugins, $name) = explode('\\', get_class($this)); $this->name = $name; } return $this->name; }
[ "final", "public", "function", "getName", "(", ")", "{", "if", "(", "!", "$", "this", "->", "name", ")", "{", "$", "this", "->", "name", "=", "get_class", "(", "$", "this", ")", ";", "list", "(", "$", "jfusion", ",", "$", "plugins", ",", "$", "...
returns the name of this JFusion plugin, using the "namespace" part of the plugin class @return string name of current JFusion plugin
[ "returns", "the", "name", "of", "this", "JFusion", "plugin", "using", "the", "namespace", "part", "of", "the", "plugin", "class" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Plugin/Plugin.php#L134-L144
jfusion/org.jfusion.framework
src/Plugin/Plugin.php
Plugin.methodDefined
final public function methodDefined($method) { $name = get_class($this); /** * TODO: FIX ISSUE DETERMINE IF A FUNCTION EXISTS OR NOT for Platform_XXX_Platform */ //if the class name is the abstract class then return false $abstractClassNames = array('JFusion\Plugin\Admin', 'JFusion\Plugin\Auth', 'J...
php
final public function methodDefined($method) { $name = get_class($this); /** * TODO: FIX ISSUE DETERMINE IF A FUNCTION EXISTS OR NOT for Platform_XXX_Platform */ //if the class name is the abstract class then return false $abstractClassNames = array('JFusion\Plugin\Admin', 'JFusion\Plugin\Auth', 'J...
[ "final", "public", "function", "methodDefined", "(", "$", "method", ")", "{", "$", "name", "=", "get_class", "(", "$", "this", ")", ";", "/**\n\t\t * TODO: FIX ISSUE DETERMINE IF A FUNCTION EXISTS OR NOT for Platform_XXX_Platform\n\t\t */", "//if the class name is the abstract ...
Function to check if a method has been defined inside a plugin like: setupFromPath @param $method @return bool
[ "Function", "to", "check", "if", "a", "method", "has", "been", "defined", "inside", "a", "plugin", "like", ":", "setupFromPath" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Plugin/Plugin.php#L153-L178
jfusion/org.jfusion.framework
src/Plugin/Plugin.php
Plugin.isConfigured
final public function isConfigured() { $jname = $this->getJname(); $result = false; if (!empty($jname)) { if (!isset(static::$status[$jname])) { $db = Factory::getDBO(); $query = $db->getQuery(true) ->select('status') ->from('#__jfusion') ->where('name = ' . $db->quote($jname)); $...
php
final public function isConfigured() { $jname = $this->getJname(); $result = false; if (!empty($jname)) { if (!isset(static::$status[$jname])) { $db = Factory::getDBO(); $query = $db->getQuery(true) ->select('status') ->from('#__jfusion') ->where('name = ' . $db->quote($jname)); $...
[ "final", "public", "function", "isConfigured", "(", ")", "{", "$", "jname", "=", "$", "this", "->", "getJname", "(", ")", ";", "$", "result", "=", "false", ";", "if", "(", "!", "empty", "(", "$", "jname", ")", ")", "{", "if", "(", "!", "isset", ...
Checks to see if the JFusion plugin is properly configured @return boolean returns true if plugin is correctly configured
[ "Checks", "to", "see", "if", "the", "JFusion", "plugin", "is", "properly", "configured" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Plugin/Plugin.php#L185-L211
jfusion/org.jfusion.framework
src/Plugin/Plugin.php
Plugin.getPluginFile
function getPluginFile($filename, &$error, &$reason) { //check to see if a path is defined $path = $this->params->get('source_path'); if (empty($path)) { $error = 1; $reason = Text::_('SET_PATH_FIRST'); } $mod_file = $path . $filename; //see if the file exists if (!file_exists($mod_file) && $erro...
php
function getPluginFile($filename, &$error, &$reason) { //check to see if a path is defined $path = $this->params->get('source_path'); if (empty($path)) { $error = 1; $reason = Text::_('SET_PATH_FIRST'); } $mod_file = $path . $filename; //see if the file exists if (!file_exists($mod_file) && $erro...
[ "function", "getPluginFile", "(", "$", "filename", ",", "&", "$", "error", ",", "&", "$", "reason", ")", "{", "//check to see if a path is defined", "$", "path", "=", "$", "this", "->", "params", "->", "get", "(", "'source_path'", ")", ";", "if", "(", "e...
Function returns the path to the modfile @param string $filename file name @param int &$error error number @param string &$reason error reason @return string $mod_file path and file of the modfile.
[ "Function", "returns", "the", "path", "to", "the", "modfile" ]
train
https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Plugin/Plugin.php#L222-L239
leedavis81/altr-ego
library/AltrEgo/AltrEgo.php
AltrEgo.callStatic
public static function callStatic($object, $name, $arguments) { $className = self::getAdapterClassName(); return $className::_callStatic($object, $name, $arguments); }
php
public static function callStatic($object, $name, $arguments) { $className = self::getAdapterClassName(); return $className::_callStatic($object, $name, $arguments); }
[ "public", "static", "function", "callStatic", "(", "$", "object", ",", "$", "name", ",", "$", "arguments", ")", "{", "$", "className", "=", "self", "::", "getAdapterClassName", "(", ")", ";", "return", "$", "className", "::", "_callStatic", "(", "$", "ob...
Allows exposure to privately defined static calls @param mixed $object - Either a AltrEgo object, you own object or the class name the static function resides @param string $name - the static function name you want to call @param mixed $arguments - Can be a single argument, or an array of them that you wish to pass to ...
[ "Allows", "exposure", "to", "privately", "defined", "static", "calls" ]
train
https://github.com/leedavis81/altr-ego/blob/1556556a33c2b6caddef94444522c5bbffc217c7/library/AltrEgo/AltrEgo.php#L139-L143
aedart/laravel-helpers
src/Traits/Session/SessionManagerTrait.php
SessionManagerTrait.getSessionManager
public function getSessionManager(): ?SessionManager { if (!$this->hasSessionManager()) { $this->setSessionManager($this->getDefaultSessionManager()); } return $this->sessionManager; }
php
public function getSessionManager(): ?SessionManager { if (!$this->hasSessionManager()) { $this->setSessionManager($this->getDefaultSessionManager()); } return $this->sessionManager; }
[ "public", "function", "getSessionManager", "(", ")", ":", "?", "SessionManager", "{", "if", "(", "!", "$", "this", "->", "hasSessionManager", "(", ")", ")", "{", "$", "this", "->", "setSessionManager", "(", "$", "this", "->", "getDefaultSessionManager", "(",...
Get session manager If no session manager has been set, this method will set and return a default session manager, if any such value is available @see getDefaultSessionManager() @return SessionManager|null session manager or null if none session manager has been set
[ "Get", "session", "manager" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Session/SessionManagerTrait.php#L53-L59
PortaText/php-sdk
src/PortaText/Command/Api/Services.php
Services.getEndpoint
protected function getEndpoint($method) { $endpoint = "sms_services"; $serviceId = $this->getArgument("id"); if (!is_null($serviceId)) { $endpoint .= "/$serviceId"; $this->delArgument("id"); } $saveTo = $this->getArgument("accept_file"); if (!i...
php
protected function getEndpoint($method) { $endpoint = "sms_services"; $serviceId = $this->getArgument("id"); if (!is_null($serviceId)) { $endpoint .= "/$serviceId"; $this->delArgument("id"); } $saveTo = $this->getArgument("accept_file"); if (!i...
[ "protected", "function", "getEndpoint", "(", "$", "method", ")", "{", "$", "endpoint", "=", "\"sms_services\"", ";", "$", "serviceId", "=", "$", "this", "->", "getArgument", "(", "\"id\"", ")", ";", "if", "(", "!", "is_null", "(", "$", "serviceId", ")", ...
Returns a string with the endpoint for the given command. @param string $method Method for this command. @return string
[ "Returns", "a", "string", "with", "the", "endpoint", "for", "the", "given", "command", "." ]
train
https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Services.php#L63-L81
parsnick/steak
src/Build/Publishers/Skip.php
Skip.handle
public function handle(Source $source, Closure $next, ...$excluded) { foreach ($excluded as $pattern) { $value = str_contains($pattern, DIRECTORY_SEPARATOR) ? $source->getPathname() : $source->getFilename(); if (str_is($pattern, $value)) { ...
php
public function handle(Source $source, Closure $next, ...$excluded) { foreach ($excluded as $pattern) { $value = str_contains($pattern, DIRECTORY_SEPARATOR) ? $source->getPathname() : $source->getFilename(); if (str_is($pattern, $value)) { ...
[ "public", "function", "handle", "(", "Source", "$", "source", ",", "Closure", "$", "next", ",", "...", "$", "excluded", ")", "{", "foreach", "(", "$", "excluded", "as", "$", "pattern", ")", "{", "$", "value", "=", "str_contains", "(", "$", "pattern", ...
Publish a source file and/or pass to $next. @param Source $source @param Closure $next @param array $excluded @return mixed
[ "Publish", "a", "source", "file", "and", "/", "or", "pass", "to", "$next", "." ]
train
https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Build/Publishers/Skip.php#L18-L32
inc2734/wp-share-buttons
src/App/Shortcode/Feedly.php
Feedly._shortcode
public function _shortcode( $attributes ) { if ( ! isset( $attributes['post_id'] ) ) { return; } $attributes = shortcode_atts( [ 'type' => 'balloon', 'post_id' => '', ], $attributes ); if ( 'official' === $attributes['type'] ) { $file = 'official'; } else { $file = 'feedly'; ...
php
public function _shortcode( $attributes ) { if ( ! isset( $attributes['post_id'] ) ) { return; } $attributes = shortcode_atts( [ 'type' => 'balloon', 'post_id' => '', ], $attributes ); if ( 'official' === $attributes['type'] ) { $file = 'official'; } else { $file = 'feedly'; ...
[ "public", "function", "_shortcode", "(", "$", "attributes", ")", "{", "if", "(", "!", "isset", "(", "$", "attributes", "[", "'post_id'", "]", ")", ")", "{", "return", ";", "}", "$", "attributes", "=", "shortcode_atts", "(", "[", "'type'", "=>", "'ballo...
Register shortcode @param array $attributes @return void
[ "Register", "shortcode" ]
train
https://github.com/inc2734/wp-share-buttons/blob/cd032893ca083a343f5871e855cce68f4ede3a17/src/App/Shortcode/Feedly.php#L24-L65
preprocess/pre-class-accessors
source/ClassAccessorsTrait.php
ClassAccessorsTrait.handleSetClassAccessors
protected function handleSetClassAccessors($property, $value) { $property = $this->studly($property); if (method_exists($this, "set{$property}")) { return $this->{"set{$property}"}($value); } }
php
protected function handleSetClassAccessors($property, $value) { $property = $this->studly($property); if (method_exists($this, "set{$property}")) { return $this->{"set{$property}"}($value); } }
[ "protected", "function", "handleSetClassAccessors", "(", "$", "property", ",", "$", "value", ")", "{", "$", "property", "=", "$", "this", "->", "studly", "(", "$", "property", ")", ";", "if", "(", "method_exists", "(", "$", "this", ",", "\"set{$property}\"...
Finds and invokes setters. @param string $property @param mixed $value
[ "Finds", "and", "invokes", "setters", "." ]
train
https://github.com/preprocess/pre-class-accessors/blob/1723028ee756824ab0bc1dab931da065497cd8fd/source/ClassAccessorsTrait.php#L60-L67
spiral-modules/auth
source/Auth/Operators/Bridges/HeaderBridge.php
HeaderBridge.writeToken
public function writeToken( Request $request, Response $response, int $lifetime, string $token = null ): Response { if (empty($token)) { return $response; } return $response->withAddedHeader($this->header, $token); }
php
public function writeToken( Request $request, Response $response, int $lifetime, string $token = null ): Response { if (empty($token)) { return $response; } return $response->withAddedHeader($this->header, $token); }
[ "public", "function", "writeToken", "(", "Request", "$", "request", ",", "Response", "$", "response", ",", "int", "$", "lifetime", ",", "string", "$", "token", "=", "null", ")", ":", "Response", "{", "if", "(", "empty", "(", "$", "token", ")", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/Bridges/HeaderBridge.php#L52-L63
flipboxstudio/orm-manager
src/Flipbox/OrmManager/Relations/HasOne.php
HasOne.setDefaultOptions
protected function setDefaultOptions(array $options=[]) { $this->defaultOptions = [ 'foreign_key' => $this->model->getForeignKey(), 'primary_key' => $this->model->getKeyName() ]; }
php
protected function setDefaultOptions(array $options=[]) { $this->defaultOptions = [ 'foreign_key' => $this->model->getForeignKey(), 'primary_key' => $this->model->getKeyName() ]; }
[ "protected", "function", "setDefaultOptions", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "defaultOptions", "=", "[", "'foreign_key'", "=>", "$", "this", "->", "model", "->", "getForeignKey", "(", ")", ",", "'primary_key'", "=...
set default options @param array $options @return void
[ "set", "default", "options" ]
train
https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasOne.php#L13-L19
flipboxstudio/orm-manager
src/Flipbox/OrmManager/Relations/HasOne.php
HasOne.setConnectedRelationOptions
protected function setConnectedRelationOptions() { $modelTable = $table = $this->model->getTable(); $toModelTable = $table = $this->toModel->getTable(); $foreignKey = $this->defaultOptions['foreign_key']; $primaryKey = $this->defaultOptions['primary_key']; if (! $this->db->isFieldExists($toModelTable, $fo...
php
protected function setConnectedRelationOptions() { $modelTable = $table = $this->model->getTable(); $toModelTable = $table = $this->toModel->getTable(); $foreignKey = $this->defaultOptions['foreign_key']; $primaryKey = $this->defaultOptions['primary_key']; if (! $this->db->isFieldExists($toModelTable, $fo...
[ "protected", "function", "setConnectedRelationOptions", "(", ")", "{", "$", "modelTable", "=", "$", "table", "=", "$", "this", "->", "model", "->", "getTable", "(", ")", ";", "$", "toModelTable", "=", "$", "table", "=", "$", "this", "->", "toModel", "->"...
set connected db relation options @return void
[ "set", "connected", "db", "relation", "options" ]
train
https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasOne.php#L48-L64
flipboxstudio/orm-manager
src/Flipbox/OrmManager/Relations/HasOne.php
HasOne.askToUseCustomeOptions
protected function askToUseCustomeOptions() { $question = "The {$this->text['foreign_text']} of table {$this->text['table']} in the table {$this->text['to_table']}, will be?"; $this->options['foreign_key'] = $this->command->ask($question, $this->defaultOptions['foreign_key']); $question = "The {$this->text['pri...
php
protected function askToUseCustomeOptions() { $question = "The {$this->text['foreign_text']} of table {$this->text['table']} in the table {$this->text['to_table']}, will be?"; $this->options['foreign_key'] = $this->command->ask($question, $this->defaultOptions['foreign_key']); $question = "The {$this->text['pri...
[ "protected", "function", "askToUseCustomeOptions", "(", ")", "{", "$", "question", "=", "\"The {$this->text['foreign_text']} of table {$this->text['table']} in the table {$this->text['to_table']}, will be?\"", ";", "$", "this", "->", "options", "[", "'foreign_key'", "]", "=", "...
ask to use custome options @return void
[ "ask", "to", "use", "custome", "options" ]
train
https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Relations/HasOne.php#L84-L91
ClanCats/Core
src/classes/CCResponse.php
CCResponse.json
public static function json( $data = array(), $status = 200, $beautify = true ) { if ( !is_array( $data ) ) { throw new CCException( "CCResponse::json - first argument has to be an array." ); } $response = new static( CCJson::encode( $data, $beautify ), $status ); $response->header( 'Content-Type', 'tex...
php
public static function json( $data = array(), $status = 200, $beautify = true ) { if ( !is_array( $data ) ) { throw new CCException( "CCResponse::json - first argument has to be an array." ); } $response = new static( CCJson::encode( $data, $beautify ), $status ); $response->header( 'Content-Type', 'tex...
[ "public", "static", "function", "json", "(", "$", "data", "=", "array", "(", ")", ",", "$", "status", "=", "200", ",", "$", "beautify", "=", "true", ")", "{", "if", "(", "!", "is_array", "(", "$", "data", ")", ")", "{", "throw", "new", "CCExcepti...
json response you can pass an array of data wich will be converted to json @param array $data @param int $status @param bool $beautify should the json output be formatted? @return CCResponse
[ "json", "response", "you", "can", "pass", "an", "array", "of", "data", "wich", "will", "be", "converted", "to", "json" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L123-L134
ClanCats/Core
src/classes/CCResponse.php
CCResponse.download
public static function download( $body, $filename = null, $status = 200 ) { return static::create( $body, $status )->as_download( $filename ); }
php
public static function download( $body, $filename = null, $status = 200 ) { return static::create( $body, $status )->as_download( $filename ); }
[ "public", "static", "function", "download", "(", "$", "body", ",", "$", "filename", "=", "null", ",", "$", "status", "=", "200", ")", "{", "return", "static", "::", "create", "(", "$", "body", ",", "$", "status", ")", "->", "as_download", "(", "$", ...
download response creates an respose that forces the browser to download as file @param string $body @param string $filename @param int $status @return CCResponse
[ "download", "response", "creates", "an", "respose", "that", "forces", "the", "browser", "to", "download", "as", "file" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L145-L148
ClanCats/Core
src/classes/CCResponse.php
CCResponse.status
public function status( $code = null ) { if ( !is_null( $code ) ) { if ( headers_sent() && !CLI ) { throw new CCException( "CCResponse::status - cannot change status header has already been send." ); } $this->_status = $code; return $this; } return $this->_status; }
php
public function status( $code = null ) { if ( !is_null( $code ) ) { if ( headers_sent() && !CLI ) { throw new CCException( "CCResponse::status - cannot change status header has already been send." ); } $this->_status = $code; return $this; } return $this->_status; }
[ "public", "function", "status", "(", "$", "code", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "code", ")", ")", "{", "if", "(", "headers_sent", "(", ")", "&&", "!", "CLI", ")", "{", "throw", "new", "CCException", "(", "\"CCResponse:...
status setter and getter @param int|null $code @return int|self
[ "status", "setter", "and", "getter" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L213-L226
ClanCats/Core
src/classes/CCResponse.php
CCResponse.header
public function header( $key, $str = null ) { if ( !is_null( $str ) ) { $this->_header[$key] = $str; return $this; } return $this->_header[$key]; }
php
public function header( $key, $str = null ) { if ( !is_null( $str ) ) { $this->_header[$key] = $str; return $this; } return $this->_header[$key]; }
[ "public", "function", "header", "(", "$", "key", ",", "$", "str", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "str", ")", ")", "{", "$", "this", "->", "_header", "[", "$", "key", "]", "=", "$", "str", ";", "return", "$", "this...
status setter and getter @param string $key @param string|null $str @return string|self
[ "status", "setter", "and", "getter" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L235-L243
ClanCats/Core
src/classes/CCResponse.php
CCResponse.as_download
public function as_download( $filename = null ) { if ( is_null( $filename ) ) { $filename = 'file.'.CCStr::suffix( $this->header( 'Content-Type' ), '/' ); } $this->header( 'Content-Description', 'File Transfer' ); $this->header( 'Content-Disposition', 'attachment; filename='.$filename ); $this->heade...
php
public function as_download( $filename = null ) { if ( is_null( $filename ) ) { $filename = 'file.'.CCStr::suffix( $this->header( 'Content-Type' ), '/' ); } $this->header( 'Content-Description', 'File Transfer' ); $this->header( 'Content-Disposition', 'attachment; filename='.$filename ); $this->heade...
[ "public", "function", "as_download", "(", "$", "filename", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "filename", ")", ")", "{", "$", "filename", "=", "'file.'", ".", "CCStr", "::", "suffix", "(", "$", "this", "->", "header", "(", "'Conte...
modify the headers to force a download @param string $filename @return void
[ "modify", "the", "headers", "to", "force", "a", "download" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L251-L267
ClanCats/Core
src/classes/CCResponse.php
CCResponse.send
public function send( $headers = false ) { if ( $headers && headers_sent() && !CLI ) { throw new CCException( "CCResponse::send - cannot send header, header has already been send." ); } if ( $headers ) { // status header header( CCIn::server( 'SERVER_PROTOCOL' ).' '.$this->_status.' '.CCResponse...
php
public function send( $headers = false ) { if ( $headers && headers_sent() && !CLI ) { throw new CCException( "CCResponse::send - cannot send header, header has already been send." ); } if ( $headers ) { // status header header( CCIn::server( 'SERVER_PROTOCOL' ).' '.$this->_status.' '.CCResponse...
[ "public", "function", "send", "(", "$", "headers", "=", "false", ")", "{", "if", "(", "$", "headers", "&&", "headers_sent", "(", ")", "&&", "!", "CLI", ")", "{", "throw", "new", "CCException", "(", "\"CCResponse::send - cannot send header, header has already bee...
send response means printing the response and setting the headers if set @param bool $headers @return void
[ "send", "response", "means", "printing", "the", "response", "and", "setting", "the", "headers", "if", "set" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCResponse.php#L276-L308
JeanWolf/yii2-jrbac
controllers/RuleController.php
RuleController.actionCreate
public function actionCreate() { $model = new RuleForm(); $model->isNewRecord = true; if ($model->load(\Yii::$app->getRequest()->post())) { $className = trim($model->className); if (class_exists($className)) { $item = new $className; if...
php
public function actionCreate() { $model = new RuleForm(); $model->isNewRecord = true; if ($model->load(\Yii::$app->getRequest()->post())) { $className = trim($model->className); if (class_exists($className)) { $item = new $className; if...
[ "public", "function", "actionCreate", "(", ")", "{", "$", "model", "=", "new", "RuleForm", "(", ")", ";", "$", "model", "->", "isNewRecord", "=", "true", ";", "if", "(", "$", "model", "->", "load", "(", "\\", "Yii", "::", "$", "app", "->", "getRequ...
创建规则
[ "创建规则" ]
train
https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/RuleController.php#L27-L53
JeanWolf/yii2-jrbac
controllers/RuleController.php
RuleController.actionUpdate
public function actionUpdate($id) { $name = $id; $model = new RuleForm(); $model->isNewRecord = false; $auth = \Yii::$app->getAuthManager(); $item = $auth->getRule($name); if ($model->load(\Yii::$app->getRequest()->post())) { $className = trim($model->cla...
php
public function actionUpdate($id) { $name = $id; $model = new RuleForm(); $model->isNewRecord = false; $auth = \Yii::$app->getAuthManager(); $item = $auth->getRule($name); if ($model->load(\Yii::$app->getRequest()->post())) { $className = trim($model->cla...
[ "public", "function", "actionUpdate", "(", "$", "id", ")", "{", "$", "name", "=", "$", "id", ";", "$", "model", "=", "new", "RuleForm", "(", ")", ";", "$", "model", "->", "isNewRecord", "=", "false", ";", "$", "auth", "=", "\\", "Yii", "::", "$",...
更新规则
[ "更新规则" ]
train
https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/RuleController.php#L56-L97
JeanWolf/yii2-jrbac
controllers/RuleController.php
RuleController.actionPermissionindex
public function actionPermissionindex($id) { $auth = \Yii::$app->getAuthManager(); $rule = $auth->getRule($id); $allItems = $auth->getPermissions(); $ruleItems = $auth->getPermissionsByRule($id); $dataProvider = new ArrayDataProvider(); $dataProvider->setModels($allIt...
php
public function actionPermissionindex($id) { $auth = \Yii::$app->getAuthManager(); $rule = $auth->getRule($id); $allItems = $auth->getPermissions(); $ruleItems = $auth->getPermissionsByRule($id); $dataProvider = new ArrayDataProvider(); $dataProvider->setModels($allIt...
[ "public", "function", "actionPermissionindex", "(", "$", "id", ")", "{", "$", "auth", "=", "\\", "Yii", "::", "$", "app", "->", "getAuthManager", "(", ")", ";", "$", "rule", "=", "$", "auth", "->", "getRule", "(", "$", "id", ")", ";", "$", "allItem...
查看规则权限关联列表
[ "查看规则权限关联列表" ]
train
https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/RuleController.php#L137-L151
JeanWolf/yii2-jrbac
controllers/RuleController.php
RuleController.actionSetpermission
public function actionSetpermission($name) { if (\Yii::$app->getRequest()->getIsPost() && isset($_POST['act'],$_POST['val'])) { $auth = \Yii::$app->getAuthManager(); $permission = $auth->getPermission($_POST['val']); try { $permission->ruleName = $name; ...
php
public function actionSetpermission($name) { if (\Yii::$app->getRequest()->getIsPost() && isset($_POST['act'],$_POST['val'])) { $auth = \Yii::$app->getAuthManager(); $permission = $auth->getPermission($_POST['val']); try { $permission->ruleName = $name; ...
[ "public", "function", "actionSetpermission", "(", "$", "name", ")", "{", "if", "(", "\\", "Yii", "::", "$", "app", "->", "getRequest", "(", ")", "->", "getIsPost", "(", ")", "&&", "isset", "(", "$", "_POST", "[", "'act'", "]", ",", "$", "_POST", "[...
设置规则关联权限
[ "设置规则关联权限" ]
train
https://github.com/JeanWolf/yii2-jrbac/blob/1e5c80038451bd5b385f83cb9344c3bd5edd85e0/controllers/RuleController.php#L154-L177
meccado/acl-admin-control-panel
src/Http/Controllers/Admin/UserController.php
UserController.store
public function store(Request $request) { $input = $request->all(); $input['password'] = Hash::make($input['password']); $user = $this->users->create($input); //create Blank profile $profile = Profile::create([ 'user_id' => $user->id, 'bio' => '', ]); $profile->save(); ...
php
public function store(Request $request) { $input = $request->all(); $input['password'] = Hash::make($input['password']); $user = $this->users->create($input); //create Blank profile $profile = Profile::create([ 'user_id' => $user->id, 'bio' => '', ]); $profile->save(); ...
[ "public", "function", "store", "(", "Request", "$", "request", ")", "{", "$", "input", "=", "$", "request", "->", "all", "(", ")", ";", "$", "input", "[", "'password'", "]", "=", "Hash", "::", "make", "(", "$", "input", "[", "'password'", "]", ")",...
Store a newly created resource in storage. @param \Illuminate\Http\Request $request @return \Illuminate\Http\RedirectRespons
[ "Store", "a", "newly", "created", "resource", "in", "storage", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/UserController.php#L60-L75
meccado/acl-admin-control-panel
src/Http/Controllers/Admin/UserController.php
UserController.show
public function show($id) { $user = $this->users->findOrFail($id); return \View::make('admin.users.show', [ 'user' => $user, 'title' => 'view', ]); }
php
public function show($id) { $user = $this->users->findOrFail($id); return \View::make('admin.users.show', [ 'user' => $user, 'title' => 'view', ]); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "user", "=", "$", "this", "->", "users", "->", "findOrFail", "(", "$", "id", ")", ";", "return", "\\", "View", "::", "make", "(", "'admin.users.show'", ",", "[", "'user'", "=>", "$", "use...
Display the specified resource. @param int $id @return \Illuminate\View\View
[ "Display", "the", "specified", "resource", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/UserController.php#L83-L90
meccado/acl-admin-control-panel
src/Http/Controllers/Admin/UserController.php
UserController.edit
public function edit($id) { $user = $this->users->findOrFail($id); $roles = Role::pluck('name', 'id'); return \View::make('admin.users.edit', [ 'user' => $user, 'roles' => $roles, 'title' => 'edit', ]); }
php
public function edit($id) { $user = $this->users->findOrFail($id); $roles = Role::pluck('name', 'id'); return \View::make('admin.users.edit', [ 'user' => $user, 'roles' => $roles, 'title' => 'edit', ]); }
[ "public", "function", "edit", "(", "$", "id", ")", "{", "$", "user", "=", "$", "this", "->", "users", "->", "findOrFail", "(", "$", "id", ")", ";", "$", "roles", "=", "Role", "::", "pluck", "(", "'name'", ",", "'id'", ")", ";", "return", "\\", ...
Show the form for editing the specified resource. @param int $id @return \Illuminate\View\View
[ "Show", "the", "form", "for", "editing", "the", "specified", "resource", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/UserController.php#L98-L107
meccado/acl-admin-control-panel
src/Http/Controllers/Admin/UserController.php
UserController.update
public function update(Request $request, $id) { $user = $this->users->findOrFail($id); $input = $request->all(); $input['password'] = Hash::make($input['password']); $user->update($input); return \Redirect::route('admin.users.index', [ ])->withMessage(trans('acl::user.users-con...
php
public function update(Request $request, $id) { $user = $this->users->findOrFail($id); $input = $request->all(); $input['password'] = Hash::make($input['password']); $user->update($input); return \Redirect::route('admin.users.index', [ ])->withMessage(trans('acl::user.users-con...
[ "public", "function", "update", "(", "Request", "$", "request", ",", "$", "id", ")", "{", "$", "user", "=", "$", "this", "->", "users", "->", "findOrFail", "(", "$", "id", ")", ";", "$", "input", "=", "$", "request", "->", "all", "(", ")", ";", ...
Update the specified resource in storage. @param \Illuminate\Http\Request $request @param int $id @return \Illuminate\View\View
[ "Update", "the", "specified", "resource", "in", "storage", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/UserController.php#L116-L124
meccado/acl-admin-control-panel
src/Http/Controllers/Admin/UserController.php
UserController.destroy
public function destroy($id) { $user = $this->users->findOrFail($id); User::destroy($id); return \Redirect::route('admin.users.index', [ ])->withMessage(trans('acl::user.users-controller-successfully_deleted')); }
php
public function destroy($id) { $user = $this->users->findOrFail($id); User::destroy($id); return \Redirect::route('admin.users.index', [ ])->withMessage(trans('acl::user.users-controller-successfully_deleted')); }
[ "public", "function", "destroy", "(", "$", "id", ")", "{", "$", "user", "=", "$", "this", "->", "users", "->", "findOrFail", "(", "$", "id", ")", ";", "User", "::", "destroy", "(", "$", "id", ")", ";", "return", "\\", "Redirect", "::", "route", "...
Remove the specified resource from storage. @param int $id @return \Illuminate\Http\RedirectRespons
[ "Remove", "the", "specified", "resource", "from", "storage", "." ]
train
https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/UserController.php#L132-L138
inpsyde/inpsyde-filter
src/DateTime.php
DateTime.filter
public function filter( $value ) { try { $result = $this->normalize_date_time( $value ); } catch ( \Exception $e ) { do_action( 'inpsyde.filter.error', 'The given value caused an exception.', [ 'method' => __METHOD__, 'exception' => $e, 'value' => $value ] ); return ''; } if ( $resu...
php
public function filter( $value ) { try { $result = $this->normalize_date_time( $value ); } catch ( \Exception $e ) { do_action( 'inpsyde.filter.error', 'The given value caused an exception.', [ 'method' => __METHOD__, 'exception' => $e, 'value' => $value ] ); return ''; } if ( $resu...
[ "public", "function", "filter", "(", "$", "value", ")", "{", "try", "{", "$", "result", "=", "$", "this", "->", "normalize_date_time", "(", "$", "value", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "do_action", "(", "'inpsyde....
{@inheritdoc}
[ "{" ]
train
https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/DateTime.php#L22-L42
inpsyde/inpsyde-filter
src/DateTime.php
DateTime.normalize_date_time
protected function normalize_date_time( $value ) { if ( $value === '' || $value === NULL ) { return $value; } if ( ! is_string( $value ) && ! is_int( $value ) && ! $value instanceof DateTime ) { return $value; } if ( is_int( $value ) ) { //timestamp $value = new \DateTime( '@' . $value ); } els...
php
protected function normalize_date_time( $value ) { if ( $value === '' || $value === NULL ) { return $value; } if ( ! is_string( $value ) && ! is_int( $value ) && ! $value instanceof DateTime ) { return $value; } if ( is_int( $value ) ) { //timestamp $value = new \DateTime( '@' . $value ); } els...
[ "protected", "function", "normalize_date_time", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "''", "||", "$", "value", "===", "NULL", ")", "{", "return", "$", "value", ";", "}", "if", "(", "!", "is_string", "(", "$", "value", ")", "...
Normalize the provided value to a formatted string. @param string|int|DateTime $value @return string
[ "Normalize", "the", "provided", "value", "to", "a", "formatted", "string", "." ]
train
https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/DateTime.php#L51-L67
spiral-modules/auth
source/Auth/AuthContext.php
AuthContext.init
public function init(TokenInterface $token) { $this->user = null; $this->token = $token; $this->closed = false; }
php
public function init(TokenInterface $token) { $this->user = null; $this->token = $token; $this->closed = false; }
[ "public", "function", "init", "(", "TokenInterface", "$", "token", ")", "{", "$", "this", "->", "user", "=", "null", ";", "$", "this", "->", "token", "=", "$", "token", ";", "$", "this", "->", "closed", "=", "false", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/AuthContext.php#L54-L59
spiral-modules/auth
source/Auth/AuthContext.php
AuthContext.getUser
public function getUser() { if (empty($this->token) || $this->isClosed()) { return null; } if (!empty($this->user)) { return $this->user; } return $this->user = $this->users->findByPK($this->token->getUserPK()); }
php
public function getUser() { if (empty($this->token) || $this->isClosed()) { return null; } if (!empty($this->user)) { return $this->user; } return $this->user = $this->users->findByPK($this->token->getUserPK()); }
[ "public", "function", "getUser", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "token", ")", "||", "$", "this", "->", "isClosed", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "empty", "(", "$", "this", "->", "use...
{@inheritdoc}
[ "{" ]
train
https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/AuthContext.php#L94-L105
rayrutjes/domain-foundation
src/Command/Gateway/DefaultCommandGateway.php
DefaultCommandGateway.sendAndWait
public function sendAndWait($command, $timeout = 300) { $commandMessage = $this->wrapCommandWithMessageEnvelope($command); // Todo: return future callback and pass it along for dispatching. return $this->commandBus->dispatch($commandMessage); }
php
public function sendAndWait($command, $timeout = 300) { $commandMessage = $this->wrapCommandWithMessageEnvelope($command); // Todo: return future callback and pass it along for dispatching. return $this->commandBus->dispatch($commandMessage); }
[ "public", "function", "sendAndWait", "(", "$", "command", ",", "$", "timeout", "=", "300", ")", "{", "$", "commandMessage", "=", "$", "this", "->", "wrapCommandWithMessageEnvelope", "(", "$", "command", ")", ";", "// Todo: return future callback and pass it along fo...
@param mixed $command @param int $timeout Timeout in milliseconds. @return mixed
[ "@param", "mixed", "$command", "@param", "int", "$timeout", "Timeout", "in", "milliseconds", "." ]
train
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/Gateway/DefaultCommandGateway.php#L41-L47
rayrutjes/domain-foundation
src/Command/Gateway/DefaultCommandGateway.php
DefaultCommandGateway.wrapCommandWithMessageEnvelope
private function wrapCommandWithMessageEnvelope($command) { if ($command instanceof Command) { return $command; } if ($command instanceof Serializable) { return new GenericCommand(MessageIdentifier::generate(), $command); } throw new \InvalidArgument...
php
private function wrapCommandWithMessageEnvelope($command) { if ($command instanceof Command) { return $command; } if ($command instanceof Serializable) { return new GenericCommand(MessageIdentifier::generate(), $command); } throw new \InvalidArgument...
[ "private", "function", "wrapCommandWithMessageEnvelope", "(", "$", "command", ")", "{", "if", "(", "$", "command", "instanceof", "Command", ")", "{", "return", "$", "command", ";", "}", "if", "(", "$", "command", "instanceof", "Serializable", ")", "{", "retu...
@param $command @return Command
[ "@param", "$command" ]
train
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/Command/Gateway/DefaultCommandGateway.php#L54-L65
factorio-item-browser/export-data
src/Entity/Recipe.php
Recipe.setIngredients
public function setIngredients(array $ingredients) { $this->ingredients = array_values(array_filter($ingredients, function ($ingredient): bool { return $ingredient instanceof Ingredient; })); return $this; }
php
public function setIngredients(array $ingredients) { $this->ingredients = array_values(array_filter($ingredients, function ($ingredient): bool { return $ingredient instanceof Ingredient; })); return $this; }
[ "public", "function", "setIngredients", "(", "array", "$", "ingredients", ")", "{", "$", "this", "->", "ingredients", "=", "array_values", "(", "array_filter", "(", "$", "ingredients", ",", "function", "(", "$", "ingredient", ")", ":", "bool", "{", "return",...
Sets the ingredients of the recipe. @param array|Ingredient[] $ingredients @return $this Implementing fluent interface.
[ "Sets", "the", "ingredients", "of", "the", "recipe", "." ]
train
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe.php#L145-L151
factorio-item-browser/export-data
src/Entity/Recipe.php
Recipe.setProducts
public function setProducts(array $products) { $this->products = array_values(array_filter($products, function ($product): bool { return $product instanceof Product; })); return $this; }
php
public function setProducts(array $products) { $this->products = array_values(array_filter($products, function ($product): bool { return $product instanceof Product; })); return $this; }
[ "public", "function", "setProducts", "(", "array", "$", "products", ")", "{", "$", "this", "->", "products", "=", "array_values", "(", "array_filter", "(", "$", "products", ",", "function", "(", "$", "product", ")", ":", "bool", "{", "return", "$", "prod...
Sets the products of the recipe. @param array|Product[] $products @return $this Implementing fluent interface.
[ "Sets", "the", "products", "of", "the", "recipe", "." ]
train
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe.php#L178-L184
factorio-item-browser/export-data
src/Entity/Recipe.php
Recipe.writeData
public function writeData(): array { $dataBuilder = new DataBuilder(); $dataBuilder->setString('n', $this->name, '') ->setString('m', $this->mode, '') ->setArray('i', $this->ingredients, function (Ingredient $ingredient): array { return...
php
public function writeData(): array { $dataBuilder = new DataBuilder(); $dataBuilder->setString('n', $this->name, '') ->setString('m', $this->mode, '') ->setArray('i', $this->ingredients, function (Ingredient $ingredient): array { return...
[ "public", "function", "writeData", "(", ")", ":", "array", "{", "$", "dataBuilder", "=", "new", "DataBuilder", "(", ")", ";", "$", "dataBuilder", "->", "setString", "(", "'n'", ",", "$", "this", "->", "name", ",", "''", ")", "->", "setString", "(", "...
Writes the entity data to an array. @return array
[ "Writes", "the", "entity", "data", "to", "an", "array", "." ]
train
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe.php#L310-L327
factorio-item-browser/export-data
src/Entity/Recipe.php
Recipe.readData
public function readData(DataContainer $data) { $this->name = $data->getString('n', ''); $this->mode = $data->getString('m', ''); $this->ingredients = array_map(function (DataContainer $data): Ingredient { return (new Ingredient())->readData($data); }, $data->getObjectArr...
php
public function readData(DataContainer $data) { $this->name = $data->getString('n', ''); $this->mode = $data->getString('m', ''); $this->ingredients = array_map(function (DataContainer $data): Ingredient { return (new Ingredient())->readData($data); }, $data->getObjectArr...
[ "public", "function", "readData", "(", "DataContainer", "$", "data", ")", "{", "$", "this", "->", "name", "=", "$", "data", "->", "getString", "(", "'n'", ",", "''", ")", ";", "$", "this", "->", "mode", "=", "$", "data", "->", "getString", "(", "'m...
Reads the entity data. @param DataContainer $data @return $this
[ "Reads", "the", "entity", "data", "." ]
train
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe.php#L334-L350
factorio-item-browser/export-data
src/Entity/Recipe.php
Recipe.calculateHash
public function calculateHash(): string { return EntityUtils::calculateHashOfArray([ $this->name, $this->mode, array_map(function (Ingredient $ingredient): string { return $ingredient->calculateHash(); }, $this->ingredients), array_...
php
public function calculateHash(): string { return EntityUtils::calculateHashOfArray([ $this->name, $this->mode, array_map(function (Ingredient $ingredient): string { return $ingredient->calculateHash(); }, $this->ingredients), array_...
[ "public", "function", "calculateHash", "(", ")", ":", "string", "{", "return", "EntityUtils", "::", "calculateHashOfArray", "(", "[", "$", "this", "->", "name", ",", "$", "this", "->", "mode", ",", "array_map", "(", "function", "(", "Ingredient", "$", "ing...
Calculates a hash value representing the entity. @return string
[ "Calculates", "a", "hash", "value", "representing", "the", "entity", "." ]
train
https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe.php#L356-L373
thienhungho/yii2-order-management
src/modules/MyOrder/controllers/OrderController.php
OrderController.actionIndex
public function actionIndex() { $searchModel = new OrderSearch(); $queryParams = request()->queryParams; $queryParams['OrderSearch']['customer_username'] = get_current_user_name(); $dataProvider = $searchModel->search($queryParams); $dataProvider->sort->defaultOrder = [...
php
public function actionIndex() { $searchModel = new OrderSearch(); $queryParams = request()->queryParams; $queryParams['OrderSearch']['customer_username'] = get_current_user_name(); $dataProvider = $searchModel->search($queryParams); $dataProvider->sort->defaultOrder = [...
[ "public", "function", "actionIndex", "(", ")", "{", "$", "searchModel", "=", "new", "OrderSearch", "(", ")", ";", "$", "queryParams", "=", "request", "(", ")", "->", "queryParams", ";", "$", "queryParams", "[", "'OrderSearch'", "]", "[", "'customer_username'...
Lists all Order models. @return mixed
[ "Lists", "all", "Order", "models", "." ]
train
https://github.com/thienhungho/yii2-order-management/blob/f263f0b2168d6f5e99cee2e20a5878d09d4e81c0/src/modules/MyOrder/controllers/OrderController.php#L33-L46
xinix-technology/norm
src/Norm/Type/NDateTime.php
NDateTime.tzFormat
public function tzFormat($format, $tz = null) { if (isset($tz)) { $this->setTimezone(new DateTimeZone($tz)); } return $this->format($format); }
php
public function tzFormat($format, $tz = null) { if (isset($tz)) { $this->setTimezone(new DateTimeZone($tz)); } return $this->format($format); }
[ "public", "function", "tzFormat", "(", "$", "format", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "tz", ")", ")", "{", "$", "this", "->", "setTimezone", "(", "new", "DateTimeZone", "(", "$", "tz", ")", ")", ";", "}", "r...
Formatting by timezone @param string $format @param string $tz @return mixed
[ "Formatting", "by", "timezone" ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Type/NDateTime.php#L38-L45
xinix-technology/norm
src/Norm/Type/NDateTime.php
NDateTime.jsonSerialize
public function jsonSerialize() { if ($tz = Norm::options('tz')) { $this->setTimezone(new DateTimeZone($tz)); } return $this->format('c'); }
php
public function jsonSerialize() { if ($tz = Norm::options('tz')) { $this->setTimezone(new DateTimeZone($tz)); } return $this->format('c'); }
[ "public", "function", "jsonSerialize", "(", ")", "{", "if", "(", "$", "tz", "=", "Norm", "::", "options", "(", "'tz'", ")", ")", "{", "$", "this", "->", "setTimezone", "(", "new", "DateTimeZone", "(", "$", "tz", ")", ")", ";", "}", "return", "$", ...
Perform serialization of this implementation. @return string
[ "Perform", "serialization", "of", "this", "implementation", "." ]
train
https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Type/NDateTime.php#L52-L59
javiacei/IdeupSimplePaginatorBundle
Twig/Extension/PaginatorExtension.php
PaginatorExtension.render
public function render($route, $id = null, $options = array(), $view = null) { return $this->pagebar->render($route, $id, $options, $view); }
php
public function render($route, $id = null, $options = array(), $view = null) { return $this->pagebar->render($route, $id, $options, $view); }
[ "public", "function", "render", "(", "$", "route", ",", "$", "id", "=", "null", ",", "$", "options", "=", "array", "(", ")", ",", "$", "view", "=", "null", ")", "{", "return", "$", "this", "->", "pagebar", "->", "render", "(", "$", "route", ",", ...
Renders the paginator @param string $route @param string $id @param array $options @param string $view @return string
[ "Renders", "the", "paginator" ]
train
https://github.com/javiacei/IdeupSimplePaginatorBundle/blob/12639a9c75bc403649fc2b2881e190a017d8c5b2/Twig/Extension/PaginatorExtension.php#L46-L49
titon/db
src/Titon/Db/Behavior/ConverterBehavior.php
ConverterBehavior.convert
public function convert($field, $type, array $options = []) { if (!isset($this->_defaults[$type])) { throw new InvalidArgumentException(sprintf('Converter %s does not exist', $type)); } $this->_converters[$field] = Hash::merge([ 'encode' => true, 'decode' => ...
php
public function convert($field, $type, array $options = []) { if (!isset($this->_defaults[$type])) { throw new InvalidArgumentException(sprintf('Converter %s does not exist', $type)); } $this->_converters[$field] = Hash::merge([ 'encode' => true, 'decode' => ...
[ "public", "function", "convert", "(", "$", "field", ",", "$", "type", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_defaults", "[", "$", "type", "]", ")", ")", "{", "throw", "new", "In...
Define a converter for a specific field. @param string $field @param string $type @param array $options @return $this @throws \Titon\Db\Exception\InvalidArgumentException
[ "Define", "a", "converter", "for", "a", "specific", "field", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/ConverterBehavior.php#L56-L68
titon/db
src/Titon/Db/Behavior/ConverterBehavior.php
ConverterBehavior.preSave
public function preSave(Event $event, Query $query, $id, array &$data) { $repo = $this->getRepository(); $converters = $this->getConverters(); foreach ($data as $key => $value) { if (empty($converters[$key])) { continue; } $converter = $conve...
php
public function preSave(Event $event, Query $query, $id, array &$data) { $repo = $this->getRepository(); $converters = $this->getConverters(); foreach ($data as $key => $value) { if (empty($converters[$key])) { continue; } $converter = $conve...
[ "public", "function", "preSave", "(", "Event", "$", "event", ",", "Query", "$", "query", ",", "$", "id", ",", "array", "&", "$", "data", ")", "{", "$", "repo", "=", "$", "this", "->", "getRepository", "(", ")", ";", "$", "converters", "=", "$", "...
Apply the encoding converter before a record is saved. @param \Titon\Event\Event $event @param \Titon\Db\Query $query @param int|int[] $id @param array $data @return bool
[ "Apply", "the", "encoding", "converter", "before", "a", "record", "is", "saved", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/ConverterBehavior.php#L121-L152
titon/db
src/Titon/Db/Behavior/ConverterBehavior.php
ConverterBehavior.postFind
public function postFind(Event $event, array &$results, $finder) { if (!in_array($finder, ['first', 'all'])) { return; } $repo = $this->getRepository(); $converters = $this->getConverters(); foreach ($results as $i => $result) { foreach ($result as $key ...
php
public function postFind(Event $event, array &$results, $finder) { if (!in_array($finder, ['first', 'all'])) { return; } $repo = $this->getRepository(); $converters = $this->getConverters(); foreach ($results as $i => $result) { foreach ($result as $key ...
[ "public", "function", "postFind", "(", "Event", "$", "event", ",", "array", "&", "$", "results", ",", "$", "finder", ")", "{", "if", "(", "!", "in_array", "(", "$", "finder", ",", "[", "'first'", ",", "'all'", "]", ")", ")", "{", "return", ";", "...
Apply the decoding converter after a record is retrieved. @param \Titon\Event\Event $event @param array $results @param string $finder
[ "Apply", "the", "decoding", "converter", "after", "a", "record", "is", "retrieved", "." ]
train
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/ConverterBehavior.php#L161-L196
nexusnetsoftgmbh/nexuscli
src/Nexus/DockerClient/Communication/Command/Compose/DockerComposeStopCommand.php
DockerComposeStopCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $files = $input->getArgument('files'); $fileSuffix = ' -f ' . implode(' -f ', $files); $command = sprintf('%s stop -d', $fileSuffix); $response = $this->getFacade()->runDockerCompose($command); if ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $files = $input->getArgument('files'); $fileSuffix = ' -f ' . implode(' -f ', $files); $command = sprintf('%s stop -d', $fileSuffix); $response = $this->getFacade()->runDockerCompose($command); if ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "files", "=", "$", "input", "->", "getArgument", "(", "'files'", ")", ";", "$", "fileSuffix", "=", "' -f '", ".", "implode", "(",...
@param \Symfony\Component\Console\Input\InputInterface $input @param \Symfony\Component\Console\Output\OutputInterface $output @return int|null|void
[ "@param", "\\", "Symfony", "\\", "Component", "\\", "Console", "\\", "Input", "\\", "InputInterface", "$input", "@param", "\\", "Symfony", "\\", "Component", "\\", "Console", "\\", "Output", "\\", "OutputInterface", "$output" ]
train
https://github.com/nexusnetsoftgmbh/nexuscli/blob/8416b43d31ad56ea379ae2b0bf85d456e78ba67a/src/Nexus/DockerClient/Communication/Command/Compose/DockerComposeStopCommand.php#L31-L42
arsengoian/viper-framework
src/Viper/Support/Libs/DataStream.php
DataStream.mergeData
private function mergeData($array) { $results = [ 'post' => new DataCollection(), 'file' => new DataCollection() ]; if (count($array['post']) > 0) { foreach($array['post'] as $key => $value) { foreach($value as $k => $v) { ...
php
private function mergeData($array) { $results = [ 'post' => new DataCollection(), 'file' => new DataCollection() ]; if (count($array['post']) > 0) { foreach($array['post'] as $key => $value) { foreach($value as $k => $v) { ...
[ "private", "function", "mergeData", "(", "$", "array", ")", "{", "$", "results", "=", "[", "'post'", "=>", "new", "DataCollection", "(", ")", ",", "'file'", "=>", "new", "DataCollection", "(", ")", "]", ";", "if", "(", "count", "(", "$", "array", "["...
@function mergeData @param $array array Ugly ugly ugly @returns array
[ "@function", "mergeData", "@param", "$array", "array" ]
train
https://github.com/arsengoian/viper-framework/blob/22796c5cc219cae3ca0b4af370a347ba2acab0f2/src/Viper/Support/Libs/DataStream.php#L227-L267
antonmedv/silicone
src/Silicone/Application.php
Application.getRootDir
public function getRootDir() { static $dir; if (empty($dir)) { $rc = new \ReflectionClass(get_class($this)); $dir = dirname(dirname($rc->getFileName())); } return $dir; }
php
public function getRootDir() { static $dir; if (empty($dir)) { $rc = new \ReflectionClass(get_class($this)); $dir = dirname(dirname($rc->getFileName())); } return $dir; }
[ "public", "function", "getRootDir", "(", ")", "{", "static", "$", "dir", ";", "if", "(", "empty", "(", "$", "dir", ")", ")", "{", "$", "rc", "=", "new", "\\", "ReflectionClass", "(", "get_class", "(", "$", "this", ")", ")", ";", "$", "dir", "=", ...
Get root directory. @return string
[ "Get", "root", "directory", "." ]
train
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Application.php#L39-L47
antonmedv/silicone
src/Silicone/Application.php
Application.getCacheDir
public function getCacheDir() { static $dir; if (empty($dir)) { $dir = $this->getOpenDir() . '/cache/'; if (!is_dir($dir)) { mkdir($dir, 0755, true); } } return $dir; }
php
public function getCacheDir() { static $dir; if (empty($dir)) { $dir = $this->getOpenDir() . '/cache/'; if (!is_dir($dir)) { mkdir($dir, 0755, true); } } return $dir; }
[ "public", "function", "getCacheDir", "(", ")", "{", "static", "$", "dir", ";", "if", "(", "empty", "(", "$", "dir", ")", ")", "{", "$", "dir", "=", "$", "this", "->", "getOpenDir", "(", ")", ".", "'/cache/'", ";", "if", "(", "!", "is_dir", "(", ...
Get cache directory. @return string
[ "Get", "cache", "directory", "." ]
train
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Application.php#L66-L77
antonmedv/silicone
src/Silicone/Application.php
Application.getLogDir
public function getLogDir() { static $dir; if (empty($dir)) { $dir = $this->getOpenDir() . '/log/'; if (!is_dir($dir)) { mkdir($dir, 0755, true); } } return $dir; }
php
public function getLogDir() { static $dir; if (empty($dir)) { $dir = $this->getOpenDir() . '/log/'; if (!is_dir($dir)) { mkdir($dir, 0755, true); } } return $dir; }
[ "public", "function", "getLogDir", "(", ")", "{", "static", "$", "dir", ";", "if", "(", "empty", "(", "$", "dir", ")", ")", "{", "$", "dir", "=", "$", "this", "->", "getOpenDir", "(", ")", ".", "'/log/'", ";", "if", "(", "!", "is_dir", "(", "$"...
Get log directory. @return string
[ "Get", "log", "directory", "." ]
train
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Application.php#L83-L94
antonmedv/silicone
src/Silicone/Application.php
Application.formType
public function formType($type, $data = null, array $options = array()) { return $this['form.factory']->create($type, $data, $options); }
php
public function formType($type, $data = null, array $options = array()) { return $this['form.factory']->create($type, $data, $options); }
[ "public", "function", "formType", "(", "$", "type", ",", "$", "data", "=", "null", ",", "array", "$", "options", "=", "array", "(", ")", ")", "{", "return", "$", "this", "[", "'form.factory'", "]", "->", "create", "(", "$", "type", ",", "$", "data"...
Creates and returns a Form instance from the type of the form. @param string|FormTypeInterface $type The built type of the form @param mixed $data The initial data for the form @param array $options Options for the form @return Form
[ "Creates", "and", "returns", "a", "Form", "instance", "from", "the", "type", "of", "the", "form", "." ]
train
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Application.php#L118-L121
antonmedv/silicone
src/Silicone/Application.php
Application.log
public function log($message, array $context = array(), $level = Logger::INFO) { return $this['monolog']->addRecord($level, $message, $context); }
php
public function log($message, array $context = array(), $level = Logger::INFO) { return $this['monolog']->addRecord($level, $message, $context); }
[ "public", "function", "log", "(", "$", "message", ",", "array", "$", "context", "=", "array", "(", ")", ",", "$", "level", "=", "Logger", "::", "INFO", ")", "{", "return", "$", "this", "[", "'monolog'", "]", "->", "addRecord", "(", "$", "level", ",...
Adds a log record. @param string $message The log message @param array $context The log context @param integer $level The logging level @return Boolean Whether the record has been processed
[ "Adds", "a", "log", "record", "." ]
train
https://github.com/antonmedv/silicone/blob/e4a67ed41f0f419984df642b303f2a491c9a3933/src/Silicone/Application.php#L132-L135
boekkooi/tactician-amqp
src/Middleware/PublishMiddleware.php
PublishMiddleware.execute
public function execute($command, callable $next) { if (!$command instanceof Message) { return $next($command); } return $this->locator ->getPublisherForMessage($command) ->publish($command); }
php
public function execute($command, callable $next) { if (!$command instanceof Message) { return $next($command); } return $this->locator ->getPublisherForMessage($command) ->publish($command); }
[ "public", "function", "execute", "(", "$", "command", ",", "callable", "$", "next", ")", "{", "if", "(", "!", "$", "command", "instanceof", "Message", ")", "{", "return", "$", "next", "(", "$", "command", ")", ";", "}", "return", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Middleware/PublishMiddleware.php#L29-L38
prolic/Concurrent-PHP-Utils
src/ConcurrentPhpUtils/CountDownLatch.php
CountDownLatch.await
public function await($timeout = 0, TimeUnit $unit = null) { if (null !== $unit) { $timeout = $unit->toMicros($timeout); } $timeoutAt = microtime(true) + ($timeout / 1000000); while (0 != $this->count) { if ($timeout > 0 && (microtime(true) > $timeoutAt)) { ...
php
public function await($timeout = 0, TimeUnit $unit = null) { if (null !== $unit) { $timeout = $unit->toMicros($timeout); } $timeoutAt = microtime(true) + ($timeout / 1000000); while (0 != $this->count) { if ($timeout > 0 && (microtime(true) > $timeoutAt)) { ...
[ "public", "function", "await", "(", "$", "timeout", "=", "0", ",", "TimeUnit", "$", "unit", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "unit", ")", "{", "$", "timeout", "=", "$", "unit", "->", "toMicros", "(", "$", "timeout", ")", ";",...
Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted. @param int $timeout @param TimeUnit|null $unit the timeunit of the given timeout @return bool true if the count reached zero and false if the waiting time elapsed before the count reached zero
[ "Causes", "the", "current", "thread", "to", "wait", "until", "the", "latch", "has", "counted", "down", "to", "zero", "unless", "the", "thread", "is", "interrupted", "." ]
train
https://github.com/prolic/Concurrent-PHP-Utils/blob/771b55b3ef79d9a7443c4f6d95373f41b9f34c4a/src/ConcurrentPhpUtils/CountDownLatch.php#L35-L48
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Values/LanguageObject.php
LanguageObject.getDefaultName
public function getDefaultName($code) { if (!array_key_exists($code, $this->defaultNameMapping)) { throw new LanguageNotFoundException(sprintf('Default language name for code "%s" not found.', $code)); } return $this->defaultNameMapping[$code]; }
php
public function getDefaultName($code) { if (!array_key_exists($code, $this->defaultNameMapping)) { throw new LanguageNotFoundException(sprintf('Default language name for code "%s" not found.', $code)); } return $this->defaultNameMapping[$code]; }
[ "public", "function", "getDefaultName", "(", "$", "code", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "code", ",", "$", "this", "->", "defaultNameMapping", ")", ")", "{", "throw", "new", "LanguageNotFoundException", "(", "sprintf", "(", "'Default...
@param string $code @return string @throws LanguageNotFoundException
[ "@param", "string", "$code" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Values/LanguageObject.php#L122-L129
left-right/center
src/controllers/LoginController.php
LoginController.getIndex
public static function getIndex() { //show install form try { if (!DB::table(config('center.db.users'))->count()) return view('center::login.install'); } catch (\Exception $e) { if ($e->getCode() == 2002) { trigger_error('Center needs a valid database connection.'); } } return view('center::l...
php
public static function getIndex() { //show install form try { if (!DB::table(config('center.db.users'))->count()) return view('center::login.install'); } catch (\Exception $e) { if ($e->getCode() == 2002) { trigger_error('Center needs a valid database connection.'); } } return view('center::l...
[ "public", "static", "function", "getIndex", "(", ")", "{", "//show install form", "try", "{", "if", "(", "!", "DB", "::", "table", "(", "config", "(", "'center.db.users'", ")", ")", "->", "count", "(", ")", ")", "return", "view", "(", "'center::login.insta...
show login page if not logged in
[ "show", "login", "page", "if", "not", "logged", "in" ]
train
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/LoginController.php#L16-L28
left-right/center
src/controllers/LoginController.php
LoginController.postIndex
public function postIndex(Request $request) { //regular login if (DB::table(config('center.db.users'))->count()) { //attempt auth if (Auth::attempt(['email'=>$request->input('email'), 'password'=>$request->input('password')], true)) { DB::table(config('center.db.users'))->where('id', Auth::user()->id)->u...
php
public function postIndex(Request $request) { //regular login if (DB::table(config('center.db.users'))->count()) { //attempt auth if (Auth::attempt(['email'=>$request->input('email'), 'password'=>$request->input('password')], true)) { DB::table(config('center.db.users'))->where('id', Auth::user()->id)->u...
[ "public", "function", "postIndex", "(", "Request", "$", "request", ")", "{", "//regular login", "if", "(", "DB", "::", "table", "(", "config", "(", "'center.db.users'", ")", ")", "->", "count", "(", ")", ")", "{", "//attempt auth", "if", "(", "Auth", "::...
handle a post to the login or install form
[ "handle", "a", "post", "to", "the", "login", "or", "install", "form" ]
train
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/LoginController.php#L31-L60
left-right/center
src/controllers/LoginController.php
LoginController.postReset
public function postReset(Request $request) { //get user if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $request->input('email'))->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ 'error'=>trans('center::site.p...
php
public function postReset(Request $request) { //get user if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $request->input('email'))->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ 'error'=>trans('center::site.p...
[ "public", "function", "postReset", "(", "Request", "$", "request", ")", "{", "//get user", "if", "(", "!", "$", "user", "=", "DB", "::", "table", "(", "config", "(", "'center.db.users'", ")", ")", "->", "whereNull", "(", "'deleted_at'", ")", "->", "where...
send reset email
[ "send", "reset", "email" ]
train
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/LoginController.php#L74-L97
left-right/center
src/controllers/LoginController.php
LoginController.getChange
public function getChange($email, $token) { //todo check email / token combo if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $email)->where('token', $token)->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ 'erro...
php
public function getChange($email, $token) { //todo check email / token combo if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $email)->where('token', $token)->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ 'erro...
[ "public", "function", "getChange", "(", "$", "email", ",", "$", "token", ")", "{", "//todo check email / token combo", "if", "(", "!", "$", "user", "=", "DB", "::", "table", "(", "config", "(", "'center.db.users'", ")", ")", "->", "whereNull", "(", "'delet...
reset password form
[ "reset", "password", "form" ]
train
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/LoginController.php#L100-L112
left-right/center
src/controllers/LoginController.php
LoginController.postChange
public function postChange(Request $request) { if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $request->input('email'))->where('token', $request->input('token'))->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ '...
php
public function postChange(Request $request) { if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $request->input('email'))->where('token', $request->input('token'))->first()) { return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([ '...
[ "public", "function", "postChange", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "user", "=", "DB", "::", "table", "(", "config", "(", "'center.db.users'", ")", ")", "->", "whereNull", "(", "'deleted_at'", ")", "->", "where", "(", "'e...
send reset email
[ "send", "reset", "email" ]
train
https://github.com/left-right/center/blob/47c225538475ca3e87fa49f31a323b6e6bd4eff2/src/controllers/LoginController.php#L115-L132
goten4/GtnDataTables
src/GtnDataTables/Service/DataTableAbstractFactory.php
DataTableAbstractFactory.createServiceWithName
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $config = $this->getConfig($serviceLocator); $config = $config[$requestedName]; if (!isset($config['collectorFactory'])) { throw new MissingConfigurationException('Unable to c...
php
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $config = $this->getConfig($serviceLocator); $config = $config[$requestedName]; if (!isset($config['collectorFactory'])) { throw new MissingConfigurationException('Unable to c...
[ "public", "function", "createServiceWithName", "(", "ServiceLocatorInterface", "$", "serviceLocator", ",", "$", "name", ",", "$", "requestedName", ")", "{", "$", "config", "=", "$", "this", "->", "getConfig", "(", "$", "serviceLocator", ")", ";", "$", "config"...
Create service with name @param ServiceLocatorInterface $serviceLocator @param $name @param $requestedName @return mixed @throws MissingConfigurationException
[ "Create", "service", "with", "name" ]
train
https://github.com/goten4/GtnDataTables/blob/59748ecf5a59492481789e2936a0c55b9df5da5e/src/GtnDataTables/Service/DataTableAbstractFactory.php#L51-L79
redaigbaria/oauth2
examples/relational/Storage/ClientStorage.php
ClientStorage.get
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null) { $query = Capsule::table('oauth_clients') ->select('oauth_clients.*') ->where('oauth_clients.id', $clientId); if ($clientSecret !== null) { $...
php
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null) { $query = Capsule::table('oauth_clients') ->select('oauth_clients.*') ->where('oauth_clients.id', $clientId); if ($clientSecret !== null) { $...
[ "public", "function", "get", "(", "$", "clientId", ",", "$", "clientSecret", "=", "null", ",", "$", "redirectUri", "=", "null", ",", "$", "grantType", "=", "null", ")", "{", "$", "query", "=", "Capsule", "::", "table", "(", "'oauth_clients'", ")", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/examples/relational/Storage/ClientStorage.php#L16-L45
redaigbaria/oauth2
examples/relational/Storage/ClientStorage.php
ClientStorage.getBySession
public function getBySession(SessionEntity $session) { $result = Capsule::table('oauth_clients') ->select(['oauth_clients.id', 'oauth_clients.name']) ->join('oauth_sessions', 'oauth_clients.id', '=', 'oauth_sessions.client_id') ...
php
public function getBySession(SessionEntity $session) { $result = Capsule::table('oauth_clients') ->select(['oauth_clients.id', 'oauth_clients.name']) ->join('oauth_sessions', 'oauth_clients.id', '=', 'oauth_sessions.client_id') ...
[ "public", "function", "getBySession", "(", "SessionEntity", "$", "session", ")", "{", "$", "result", "=", "Capsule", "::", "table", "(", "'oauth_clients'", ")", "->", "select", "(", "[", "'oauth_clients.id'", ",", "'oauth_clients.name'", "]", ")", "->", "join"...
{@inheritdoc}
[ "{" ]
train
https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/examples/relational/Storage/ClientStorage.php#L50-L69
shrink0r/workflux
src/State/StateMap.php
StateMap.put
public function put(StateInterface $state): self { $cloned_map = clone $this; $cloned_map->internal_map->put($state->getName(), $state); return $cloned_map; }
php
public function put(StateInterface $state): self { $cloned_map = clone $this; $cloned_map->internal_map->put($state->getName(), $state); return $cloned_map; }
[ "public", "function", "put", "(", "StateInterface", "$", "state", ")", ":", "self", "{", "$", "cloned_map", "=", "clone", "$", "this", ";", "$", "cloned_map", "->", "internal_map", "->", "put", "(", "$", "state", "->", "getName", "(", ")", ",", "$", ...
@param StateInterface @return self
[ "@param", "StateInterface" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateMap.php#L37-L42
shrink0r/workflux
src/State/StateMap.php
StateMap.find
public function find(Closure $query): self { $states = []; foreach ($this->internal_map as $state) { if (true === $query($state)) { $states[] = $state; } } return new self($states); }
php
public function find(Closure $query): self { $states = []; foreach ($this->internal_map as $state) { if (true === $query($state)) { $states[] = $state; } } return new self($states); }
[ "public", "function", "find", "(", "Closure", "$", "query", ")", ":", "self", "{", "$", "states", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "internal_map", "as", "$", "state", ")", "{", "if", "(", "true", "===", "$", "query", "(", "$...
@param Closure $query @return self
[ "@param", "Closure", "$query" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateMap.php#L49-L58
shrink0r/workflux
src/State/StateMap.php
StateMap.findOne
public function findOne(Closure $query) { foreach ($this->internal_map as $state) { if (true === $query($state)) { return $state; } } return null; }
php
public function findOne(Closure $query) { foreach ($this->internal_map as $state) { if (true === $query($state)) { return $state; } } return null; }
[ "public", "function", "findOne", "(", "Closure", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "internal_map", "as", "$", "state", ")", "{", "if", "(", "true", "===", "$", "query", "(", "$", "state", ")", ")", "{", "return", "$", "stat...
@param Closure $query @return StateInterface|null
[ "@param", "Closure", "$query" ]
train
https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/StateMap.php#L65-L73
qcubed/orm
src/Codegen/DatabaseCodeGen.php
DatabaseCodeGen.validateTableColumn
public function validateTableColumn($strTableName, $strColumnName) { $strTableName = trim(strtolower($strTableName)); $strColumnName = trim(strtolower($strColumnName)); if (array_key_exists($strTableName, $this->objTableArray)) { $strTableName = $this->objTableArray[$strTableNam...
php
public function validateTableColumn($strTableName, $strColumnName) { $strTableName = trim(strtolower($strTableName)); $strColumnName = trim(strtolower($strColumnName)); if (array_key_exists($strTableName, $this->objTableArray)) { $strTableName = $this->objTableArray[$strTableNam...
[ "public", "function", "validateTableColumn", "(", "$", "strTableName", ",", "$", "strColumnName", ")", "{", "$", "strTableName", "=", "trim", "(", "strtolower", "(", "$", "strTableName", ")", ")", ";", "$", "strColumnName", "=", "trim", "(", "strtolower", "(...
Given a CASE INSENSITIVE table and column name, it will return TRUE if the Table/Column exists ANYWHERE in the already analyzed database @param string $strTableName @param string $strColumnName @return boolean true if it is found/validated
[ "Given", "a", "CASE", "INSENSITIVE", "table", "and", "column", "name", "it", "will", "return", "TRUE", "if", "the", "Table", "/", "Column", "exists", "ANYWHERE", "in", "the", "already", "analyzed", "database" ]
train
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Codegen/DatabaseCodeGen.php#L125-L153
qcubed/orm
src/Codegen/DatabaseCodeGen.php
DatabaseCodeGen.getForeignKeysFromRelationshipsScript
protected function getForeignKeysFromRelationshipsScript($strTableName, $objForeignKeyArray) { foreach ($this->strRelationshipLinesQcubed as $strLine) { if ($strLine) { $objForeignKey = $this->getForeignKeyForQcubedRelationshipDefinition($strTableName, $strLine); ...
php
protected function getForeignKeysFromRelationshipsScript($strTableName, $objForeignKeyArray) { foreach ($this->strRelationshipLinesQcubed as $strLine) { if ($strLine) { $objForeignKey = $this->getForeignKeyForQcubedRelationshipDefinition($strTableName, $strLine); ...
[ "protected", "function", "getForeignKeysFromRelationshipsScript", "(", "$", "strTableName", ",", "$", "objForeignKeyArray", ")", "{", "foreach", "(", "$", "this", "->", "strRelationshipLinesQcubed", "as", "$", "strLine", ")", "{", "if", "(", "$", "strLine", ")", ...
This will go through the various Relationships Script lines (if applicable) as setup during the __constructor() through the <relationships> and <relationshipsScript> tags in the configuration settings. If no Relationships are defined, this method will simply exit making no changes. @param string $strTableName Name of...
[ "This", "will", "go", "through", "the", "various", "Relationships", "Script", "lines", "(", "if", "applicable", ")", "as", "setup", "during", "the", "__constructor", "()", "through", "the", "<relationships", ">", "and", "<relationshipsScript", ">", "tags", "in",...
train
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Codegen/DatabaseCodeGen.php#L1500-L1525
qcubed/orm
src/Codegen/DatabaseCodeGen.php
DatabaseCodeGen.getCastString
public function getCastString(SqlColumn $objColumn) { switch ($objColumn->DbType) { case Database\FieldType::BIT: return ('$mixVal = (bool)$mixVal;'); case Database\FieldType::BLOB: case Database\FieldType::CHAR: case Database\FieldType::VAR_C...
php
public function getCastString(SqlColumn $objColumn) { switch ($objColumn->DbType) { case Database\FieldType::BIT: return ('$mixVal = (bool)$mixVal;'); case Database\FieldType::BLOB: case Database\FieldType::CHAR: case Database\FieldType::VAR_C...
[ "public", "function", "getCastString", "(", "SqlColumn", "$", "objColumn", ")", "{", "switch", "(", "$", "objColumn", "->", "DbType", ")", "{", "case", "Database", "\\", "FieldType", "::", "BIT", ":", "return", "(", "'$mixVal = (bool)$mixVal;'", ")", ";", "c...
Returns a string that will cast a variable coming from the database into a php type. Doing this in the template saves significant amounts of time over using Type::cast() or GetColumn. @param SqlColumn $objColumn @return string @throws \Exception
[ "Returns", "a", "string", "that", "will", "cast", "a", "variable", "coming", "from", "the", "database", "into", "a", "php", "type", ".", "Doing", "this", "in", "the", "template", "saves", "significant", "amounts", "of", "time", "over", "using", "Type", "::...
train
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Codegen/DatabaseCodeGen.php#L1552-L1580
lmammino/e-foundation
src/Address/Model/Zone.php
Zone.setMembers
public function setMembers(Collection $members) { foreach ($members as $member) { $this->addMember($member); } return $this; }
php
public function setMembers(Collection $members) { foreach ($members as $member) { $this->addMember($member); } return $this; }
[ "public", "function", "setMembers", "(", "Collection", "$", "members", ")", "{", "foreach", "(", "$", "members", "as", "$", "member", ")", "{", "$", "this", "->", "addMember", "(", "$", "member", ")", ";", "}", "return", "$", "this", ";", "}" ]
{@inheritDoc}
[ "{" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Address/Model/Zone.php#L88-L95
lmammino/e-foundation
src/Address/Model/Zone.php
Zone.addMember
public function addMember(ZoneMemberInterface $member) { if (!$this->members->contains($member)) { $member->setParentZone($this); $this->members->add($member); } return $this; }
php
public function addMember(ZoneMemberInterface $member) { if (!$this->members->contains($member)) { $member->setParentZone($this); $this->members->add($member); } return $this; }
[ "public", "function", "addMember", "(", "ZoneMemberInterface", "$", "member", ")", "{", "if", "(", "!", "$", "this", "->", "members", "->", "contains", "(", "$", "member", ")", ")", "{", "$", "member", "->", "setParentZone", "(", "$", "this", ")", ";",...
{@inheritDoc}
[ "{" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Address/Model/Zone.php#L100-L108
lmammino/e-foundation
src/Address/Model/Zone.php
Zone.removeMember
public function removeMember(ZoneMemberInterface $member) { if ($this->members->contains($member)) { $member->setParentZone(null); $this->members->removeElement($member); } return $this; }
php
public function removeMember(ZoneMemberInterface $member) { if ($this->members->contains($member)) { $member->setParentZone(null); $this->members->removeElement($member); } return $this; }
[ "public", "function", "removeMember", "(", "ZoneMemberInterface", "$", "member", ")", "{", "if", "(", "$", "this", "->", "members", "->", "contains", "(", "$", "member", ")", ")", "{", "$", "member", "->", "setParentZone", "(", "null", ")", ";", "$", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Address/Model/Zone.php#L121-L129
ClanCats/Core
src/classes/CCViewController.php
CCViewController._respond
protected function _respond( $string ) { // if no view isset create one with the output buffer if ( is_null( $this->view ) ) { $this->theme->content = $string; } else { $this->theme->content = $this->view->render(); } // dont render the theme? Or does the request force render in modal? if ( CCR...
php
protected function _respond( $string ) { // if no view isset create one with the output buffer if ( is_null( $this->view ) ) { $this->theme->content = $string; } else { $this->theme->content = $this->view->render(); } // dont render the theme? Or does the request force render in modal? if ( CCR...
[ "protected", "function", "_respond", "(", "$", "string", ")", "{", "// if no view isset create one with the output buffer", "if", "(", "is_null", "(", "$", "this", "->", "view", ")", ")", "{", "$", "this", "->", "theme", "->", "content", "=", "$", "string", ...
When a controller gives us a string make a response out of it @param string @return CCResponse
[ "When", "a", "controller", "gives", "us", "a", "string", "make", "a", "response", "out", "of", "it" ]
train
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCViewController.php#L82-L100
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.find
public function find(ValueObject $object) { try { if (isset($object->data['identifier'])) { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($object->data['identifier']); } } catch (NotFoundException $notFoundException) { // We...
php
public function find(ValueObject $object) { try { if (isset($object->data['identifier'])) { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($object->data['identifier']); } } catch (NotFoundException $notFoundException) { // We...
[ "public", "function", "find", "(", "ValueObject", "$", "object", ")", "{", "try", "{", "if", "(", "isset", "(", "$", "object", "->", "data", "[", "'identifier'", "]", ")", ")", "{", "$", "contentType", "=", "$", "this", "->", "contentTypeService", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L96-L111
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.create
public function create(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } if ($this->logger) { $this->logger->info(sprintf('Creating contenttype %s.', ...
php
public function create(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } if ($this->logger) { $this->logger->info(sprintf('Creating contenttype %s.', ...
[ "public", "function", "create", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "ContentTypeObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "ContentTypeObject", "::", "class", ",", "get_c...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L116-L151
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.update
public function update(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } if ($this->logger) { $this->logger->info(sprintf('Updating contenttype %s.', ...
php
public function update(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } if ($this->logger) { $this->logger->info(sprintf('Updating contenttype %s.', ...
[ "public", "function", "update", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "ContentTypeObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "ContentTypeObject", "::", "class", ",", "get_c...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L156-L196
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.getNewContentTypeDraft
private function getNewContentTypeDraft(ContentType $contentType) { try { $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id); } catch (NotFoundException $e) { $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType...
php
private function getNewContentTypeDraft(ContentType $contentType) { try { $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id); } catch (NotFoundException $e) { $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType...
[ "private", "function", "getNewContentTypeDraft", "(", "ContentType", "$", "contentType", ")", "{", "try", "{", "$", "contentTypeDraft", "=", "$", "this", "->", "contentTypeService", "->", "loadContentTypeDraft", "(", "$", "contentType", "->", "id", ")", ";", "}"...
@param ContentType $contentType @return ContentTypeDraft
[ "@param", "ContentType", "$contentType" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L203-L212
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.createOrUpdate
public function createOrUpdate(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } try { $this->find($object); return $this->update($object...
php
public function createOrUpdate(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } try { $this->find($object); return $this->update($object...
[ "public", "function", "createOrUpdate", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "ContentTypeObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "ContentTypeObject", "::", "class", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L217-L230
transfer-framework/ezplatform
src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php
ContentTypeManager.remove
public function remove(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } try { $contentType = $this->find($object); $this->contentTypeServ...
php
public function remove(ObjectInterface $object) { if (!$object instanceof ContentTypeObject) { throw new UnsupportedObjectOperationException(ContentTypeObject::class, get_class($object)); } try { $contentType = $this->find($object); $this->contentTypeServ...
[ "public", "function", "remove", "(", "ObjectInterface", "$", "object", ")", "{", "if", "(", "!", "$", "object", "instanceof", "ContentTypeObject", ")", "{", "throw", "new", "UnsupportedObjectOperationException", "(", "ContentTypeObject", "::", "class", ",", "get_c...
{@inheritdoc}
[ "{" ]
train
https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php#L235-L249
lode/fem
src/routing.php
routing.handle
protected function handle($handler) { $handler_type = $this->get_handler_type($handler); // unmatched requests if (empty($handler) || empty($handler_type)) { $exception = bootstrap::get_library('exception'); throw new $exception('no route found', response::STATUS_NOT_FOUND); } // default flow: matched requ...
php
protected function handle($handler) { $handler_type = $this->get_handler_type($handler); // unmatched requests if (empty($handler) || empty($handler_type)) { $exception = bootstrap::get_library('exception'); throw new $exception('no route found', response::STATUS_NOT_FOUND); } // default flow: matched requ...
[ "protected", "function", "handle", "(", "$", "handler", ")", "{", "$", "handler_type", "=", "$", "this", "->", "get_handler_type", "(", "$", "handler", ")", ";", "// unmatched requests", "if", "(", "empty", "(", "$", "handler", ")", "||", "empty", "(", "...
find someone else and let them handle the request @param mixed $handler @see get_handler_type() @return void however, it will fire a handler or an error
[ "find", "someone", "else", "and", "let", "them", "handle", "the", "request" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/routing.php#L102-L113
lode/fem
src/routing.php
routing.find_handler_path
protected function find_handler_path($filename) { $filename = strtolower($filename); if (preg_match('{[^a-z0-9/_-]}', $filename)) { return false; } $base_path = \alsvanzelf\fem\ROOT_DIR_APP.$this->handler_base_path.'/'; $full_path = $base_path.$filename.'.php'; if (file_exists($full_path) == false) { retu...
php
protected function find_handler_path($filename) { $filename = strtolower($filename); if (preg_match('{[^a-z0-9/_-]}', $filename)) { return false; } $base_path = \alsvanzelf\fem\ROOT_DIR_APP.$this->handler_base_path.'/'; $full_path = $base_path.$filename.'.php'; if (file_exists($full_path) == false) { retu...
[ "protected", "function", "find_handler_path", "(", "$", "filename", ")", "{", "$", "filename", "=", "strtolower", "(", "$", "filename", ")", ";", "if", "(", "preg_match", "(", "'{[^a-z0-9/_-]}'", ",", "$", "filename", ")", ")", "{", "return", "false", ";",...
finds the handler's file @param string $filename a filename, relative to the handlers directory, and w/o '.php' @return string|boolean the full path, including \alsvanzelf\fem\ROOT_DIR_APP or false when not found
[ "finds", "the", "handler", "s", "file" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/routing.php#L122-L141
lode/fem
src/routing.php
routing.initialize
protected function initialize() { $request = bootstrap::get_library('request'); $response = bootstrap::get_library('response'); $exception = bootstrap::get_library('exception'); $this->url = $request::get_url(); $this->method = $request::get_method(); if (empty($this->method)) { throw new $exception('...
php
protected function initialize() { $request = bootstrap::get_library('request'); $response = bootstrap::get_library('response'); $exception = bootstrap::get_library('exception'); $this->url = $request::get_url(); $this->method = $request::get_method(); if (empty($this->method)) { throw new $exception('...
[ "protected", "function", "initialize", "(", ")", "{", "$", "request", "=", "bootstrap", "::", "get_library", "(", "'request'", ")", ";", "$", "response", "=", "bootstrap", "::", "get_library", "(", "'response'", ")", ";", "$", "exception", "=", "bootstrap", ...
makes sure $this->url and $this->method exist @return void, however, it can fire an error for unknown http methods @see \alsvanzelf\fem\request::get_method() for which ones are supported
[ "makes", "sure", "$this", "-", ">", "url", "and", "$this", "-", ">", "method", "exist" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/routing.php#L149-L160
lode/fem
src/routing.php
routing.find_handler
private function find_handler() { $handler = false; // empty url leads to the default handler if (empty($this->url)) { return $this->default_handler; } // simple mapping urls to the filesystem if ($this->map_to_filesystem && $this->find_handler_path($this->url)) { // url == handler return $this->url; }...
php
private function find_handler() { $handler = false; // empty url leads to the default handler if (empty($this->url)) { return $this->default_handler; } // simple mapping urls to the filesystem if ($this->map_to_filesystem && $this->find_handler_path($this->url)) { // url == handler return $this->url; }...
[ "private", "function", "find_handler", "(", ")", "{", "$", "handler", "=", "false", ";", "// empty url leads to the default handler", "if", "(", "empty", "(", "$", "this", "->", "url", ")", ")", "{", "return", "$", "this", "->", "default_handler", ";", "}", ...
find a handler for the requested url checks the filesystem directly if $this->map_to_filesystem is true checks user defined routes otherwise gives the default handler for empty url .. .. or when $this->fallback_to_default is true @return mixed $handler see get_handler_type()
[ "find", "a", "handler", "for", "the", "requested", "url" ]
train
https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/routing.php#L173-L200