id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,000 | secrethash/trickster | src/Trickster.php | Trickster.currencyConvert | public function currencyConvert($amount, $from, $to)
{
if($from===$to)
{
return round($amount, 2);
}
if ($this->_currencyConverter==='currencylayer')
{
return self::currencyLayerConvert($amount, $from, $to);
}
elseif ($th... | php | public function currencyConvert($amount, $from, $to)
{
if($from===$to)
{
return round($amount, 2);
}
if ($this->_currencyConverter==='currencylayer')
{
return self::currencyLayerConvert($amount, $from, $to);
}
elseif ($th... | [
"public",
"function",
"currencyConvert",
"(",
"$",
"amount",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"$",
"from",
"===",
"$",
"to",
")",
"{",
"return",
"round",
"(",
"$",
"amount",
",",
"2",
")",
";",
"}",
"if",
"(",
"$",
"this",... | This function converts the currency in desired form.
@access public
@param init $amount Amount to be converted
@param string $from Currency Code to convert "from"
@param string $to Currency code to convert "to" Default=INR
@return string Return json data | [
"This",
"function",
"converts",
"the",
"currency",
"in",
"desired",
"form",
"."
] | 8105dc7c028bc9b56988a339a4422c19e2185d83 | https://github.com/secrethash/trickster/blob/8105dc7c028bc9b56988a339a4422c19e2185d83/src/Trickster.php#L606-L625 |
224,001 | secrethash/trickster | src/Trickster.php | Trickster.smartConvert | public function smartConvert($amount, $from, $to)
{
// Smart Convert Logic
Log::info('Running Smart Currency Conversion');
if ($this->_currencyLayerApiKey != NULL)
{
$conv = self::currencyLayerConvert($amount, $from, $to);
if(!$conv)
{
... | php | public function smartConvert($amount, $from, $to)
{
// Smart Convert Logic
Log::info('Running Smart Currency Conversion');
if ($this->_currencyLayerApiKey != NULL)
{
$conv = self::currencyLayerConvert($amount, $from, $to);
if(!$conv)
{
... | [
"public",
"function",
"smartConvert",
"(",
"$",
"amount",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"// Smart Convert Logic",
"Log",
"::",
"info",
"(",
"'Running Smart Currency Conversion'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_currencyLayerApiKey",
"!=... | Smart Currency Conversion
This uses the activated APIs and increases your monthly quotas
@return float | [
"Smart",
"Currency",
"Conversion",
"This",
"uses",
"the",
"activated",
"APIs",
"and",
"increases",
"your",
"monthly",
"quotas"
] | 8105dc7c028bc9b56988a339a4422c19e2185d83 | https://github.com/secrethash/trickster/blob/8105dc7c028bc9b56988a339a4422c19e2185d83/src/Trickster.php#L715-L741 |
224,002 | secrethash/trickster | src/Trickster.php | Trickster.exchangeRateCalculate | protected function exchangeRateCalculate($rate, $amount)
{
// code
$conv = $amount * $rate;
$resque = round($conv, 2);
return $resque;
} | php | protected function exchangeRateCalculate($rate, $amount)
{
// code
$conv = $amount * $rate;
$resque = round($conv, 2);
return $resque;
} | [
"protected",
"function",
"exchangeRateCalculate",
"(",
"$",
"rate",
",",
"$",
"amount",
")",
"{",
"// code",
"$",
"conv",
"=",
"$",
"amount",
"*",
"$",
"rate",
";",
"$",
"resque",
"=",
"round",
"(",
"$",
"conv",
",",
"2",
")",
";",
"return",
"$",
"... | Calculation of the converted currency
@access protected
@return float | [
"Calculation",
"of",
"the",
"converted",
"currency"
] | 8105dc7c028bc9b56988a339a4422c19e2185d83 | https://github.com/secrethash/trickster/blob/8105dc7c028bc9b56988a339a4422c19e2185d83/src/Trickster.php#L747-L753 |
224,003 | secrethash/trickster | src/Trickster.php | Trickster._socialCurl | private function _socialCurl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/json'));
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
return $result;
} | php | private function _socialCurl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/json'));
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
return $result;
} | [
"private",
"function",
"_socialCurl",
"(",
"$",
"url",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"true",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_H... | This function used for return tweets and likes with curl
@access private
@param string $url Url need for curl to get data
@return string Return json data | [
"This",
"function",
"used",
"for",
"return",
"tweets",
"and",
"likes",
"with",
"curl"
] | 8105dc7c028bc9b56988a339a4422c19e2185d83 | https://github.com/secrethash/trickster/blob/8105dc7c028bc9b56988a339a4422c19e2185d83/src/Trickster.php#L769-L778 |
224,004 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequestGenerator.php | CertificateSigningRequestGenerator.writeCustomConfigFile | protected function writeCustomConfigFile(string $fileName, array $subjectAltNames) {
$content = implode(PHP_EOL, [
'[req]',
'prompt = no',
'string_mask = utf8only',
'distinguished_name = req_distinguished_name',
'[req_distinguished_name]',
... | php | protected function writeCustomConfigFile(string $fileName, array $subjectAltNames) {
$content = implode(PHP_EOL, [
'[req]',
'prompt = no',
'string_mask = utf8only',
'distinguished_name = req_distinguished_name',
'[req_distinguished_name]',
... | [
"protected",
"function",
"writeCustomConfigFile",
"(",
"string",
"$",
"fileName",
",",
"array",
"$",
"subjectAltNames",
")",
"{",
"$",
"content",
"=",
"implode",
"(",
"PHP_EOL",
",",
"[",
"'[req]'",
",",
"'prompt = no'",
",",
"'string_mask = utf8only'",
",",
"'d... | The subjectAltName can only be defined in the openssl config. So we need a temporary config file.
@param string $fileName
@param array $subjectAltNames | [
"The",
"subjectAltName",
"can",
"only",
"be",
"defined",
"in",
"the",
"openssl",
"config",
".",
"So",
"we",
"need",
"a",
"temporary",
"config",
"file",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequestGenerator.php#L161-L172 |
224,005 | Eluinhost/minecraft-auth | src/Protocol/DataTypeEncoders/VarInt.php | VarInt.read | private static function read($fd, $length)
{
$bytes = fread($fd, $length);
if (false === $bytes) {
return false;
}
return $bytes;
} | php | private static function read($fd, $length)
{
$bytes = fread($fd, $length);
if (false === $bytes) {
return false;
}
return $bytes;
} | [
"private",
"static",
"function",
"read",
"(",
"$",
"fd",
",",
"$",
"length",
")",
"{",
"$",
"bytes",
"=",
"fread",
"(",
"$",
"fd",
",",
"$",
"length",
")",
";",
"if",
"(",
"false",
"===",
"$",
"bytes",
")",
"{",
"return",
"false",
";",
"}",
"re... | Reads from the stream
@param $fd resource the stream to read from
@param $length int the length to read
@return string|false the read bytes or false if read failed | [
"Reads",
"from",
"the",
"stream"
] | ebe9a09d1de45dbc765545137514c8cf7c8e075f | https://github.com/Eluinhost/minecraft-auth/blob/ebe9a09d1de45dbc765545137514c8cf7c8e075f/src/Protocol/DataTypeEncoders/VarInt.php#L15-L23 |
224,006 | Eluinhost/minecraft-auth | src/Protocol/DataTypeEncoders/VarInt.php | VarInt.readUnsignedVarInt | public static function readUnsignedVarInt($data)
{
$fd = fopen('data://text/plain,' . urlencode($data), 'rb');
$original = '';
$result = $shift = 0;
do {
$readValue = self::read($fd, 1);
if(false === $readValue || $readValue === null) {
return... | php | public static function readUnsignedVarInt($data)
{
$fd = fopen('data://text/plain,' . urlencode($data), 'rb');
$original = '';
$result = $shift = 0;
do {
$readValue = self::read($fd, 1);
if(false === $readValue || $readValue === null) {
return... | [
"public",
"static",
"function",
"readUnsignedVarInt",
"(",
"$",
"data",
")",
"{",
"$",
"fd",
"=",
"fopen",
"(",
"'data://text/plain,'",
".",
"urlencode",
"(",
"$",
"data",
")",
",",
"'rb'",
")",
";",
"$",
"original",
"=",
"''",
";",
"$",
"result",
"=",... | Read a varint from beginning of the string.
@param $data String the data
@throws InvalidDataException on invalid data
@return VarInt|false the parsed VarInt if parsed, false if not enough data | [
"Read",
"a",
"varint",
"from",
"beginning",
"of",
"the",
"string",
"."
] | ebe9a09d1de45dbc765545137514c8cf7c8e075f | https://github.com/Eluinhost/minecraft-auth/blob/ebe9a09d1de45dbc765545137514c8cf7c8e075f/src/Protocol/DataTypeEncoders/VarInt.php#L32-L53 |
224,007 | Eluinhost/minecraft-auth | src/Protocol/DataTypeEncoders/VarInt.php | VarInt.writeUnsignedVarInt | public static function writeUnsignedVarInt($data) {
if($data < 0) {
throw new InvalidDataException('Cannot write negative values');
}
$orig = $data;
//single bytes don't need encoding
if ($data < 0x80) {
return new VarInt($data, pack('C', $data), 1);
... | php | public static function writeUnsignedVarInt($data) {
if($data < 0) {
throw new InvalidDataException('Cannot write negative values');
}
$orig = $data;
//single bytes don't need encoding
if ($data < 0x80) {
return new VarInt($data, pack('C', $data), 1);
... | [
"public",
"static",
"function",
"writeUnsignedVarInt",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"<",
"0",
")",
"{",
"throw",
"new",
"InvalidDataException",
"(",
"'Cannot write negative values'",
")",
";",
"}",
"$",
"orig",
"=",
"$",
"data",
";",... | Writes a VarInt
@param $data int the value to write
@return VarInt the encoded value
@throws InvalidDataException | [
"Writes",
"a",
"VarInt"
] | ebe9a09d1de45dbc765545137514c8cf7c8e075f | https://github.com/Eluinhost/minecraft-auth/blob/ebe9a09d1de45dbc765545137514c8cf7c8e075f/src/Protocol/DataTypeEncoders/VarInt.php#L62-L86 |
224,008 | Eluinhost/minecraft-auth | src/Protocol/Packets/HandshakePacket.php | HandshakePacket.fromRawData | function fromRawData($data)
{
$versionVarInt = VarInt::readUnsignedVarInt($data);
$data = substr($data, $versionVarInt->getDataLength());
$addressStringLength = VarInt::readUnsignedVarInt($data);
$data = substr($data, $addressStringLength->getDataLength());
$address = subst... | php | function fromRawData($data)
{
$versionVarInt = VarInt::readUnsignedVarInt($data);
$data = substr($data, $versionVarInt->getDataLength());
$addressStringLength = VarInt::readUnsignedVarInt($data);
$data = substr($data, $addressStringLength->getDataLength());
$address = subst... | [
"function",
"fromRawData",
"(",
"$",
"data",
")",
"{",
"$",
"versionVarInt",
"=",
"VarInt",
"::",
"readUnsignedVarInt",
"(",
"$",
"data",
")",
";",
"$",
"data",
"=",
"substr",
"(",
"$",
"data",
",",
"$",
"versionVarInt",
"->",
"getDataLength",
"(",
")",
... | Parse the raw data
@param $data String the raw data to parse (minus packet ID and packet length
@throws InvalidDataException | [
"Parse",
"the",
"raw",
"data"
] | ebe9a09d1de45dbc765545137514c8cf7c8e075f | https://github.com/Eluinhost/minecraft-auth/blob/ebe9a09d1de45dbc765545137514c8cf7c8e075f/src/Protocol/Packets/HandshakePacket.php#L115-L147 |
224,009 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequestSigner.php | CertificateSigningRequestSigner.setPkcs12 | public function setPkcs12(Pkcs12 $pkcs12) {
$this->setCertificate($pkcs12->getCertificate());
$this->setPrivateKey($pkcs12->getPrivateKey());
} | php | public function setPkcs12(Pkcs12 $pkcs12) {
$this->setCertificate($pkcs12->getCertificate());
$this->setPrivateKey($pkcs12->getPrivateKey());
} | [
"public",
"function",
"setPkcs12",
"(",
"Pkcs12",
"$",
"pkcs12",
")",
"{",
"$",
"this",
"->",
"setCertificate",
"(",
"$",
"pkcs12",
"->",
"getCertificate",
"(",
")",
")",
";",
"$",
"this",
"->",
"setPrivateKey",
"(",
"$",
"pkcs12",
"->",
"getPrivateKey",
... | Set private key and certificate of the certificate authority from PKCS12.
@param Pkcs12 $pkcs12 | [
"Set",
"private",
"key",
"and",
"certificate",
"of",
"the",
"certificate",
"authority",
"from",
"PKCS12",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequestSigner.php#L83-L86 |
224,010 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequestSigner.php | CertificateSigningRequestSigner.sign | public function sign(CertificateSigningRequest $csr, int $serial = 0): Certificate {
$certificate = openssl_csr_sign(
$csr->export(),
$this->getCertificate(),
$this->getPrivateKey(),
$this->getLifetime(),
$this->getOptions(),
$serial
... | php | public function sign(CertificateSigningRequest $csr, int $serial = 0): Certificate {
$certificate = openssl_csr_sign(
$csr->export(),
$this->getCertificate(),
$this->getPrivateKey(),
$this->getLifetime(),
$this->getOptions(),
$serial
... | [
"public",
"function",
"sign",
"(",
"CertificateSigningRequest",
"$",
"csr",
",",
"int",
"$",
"serial",
"=",
"0",
")",
":",
"Certificate",
"{",
"$",
"certificate",
"=",
"openssl_csr_sign",
"(",
"$",
"csr",
"->",
"export",
"(",
")",
",",
"$",
"this",
"->",... | Create a new Certificate.
@param CertificateSigningRequest $csr
@param int $serial
@return Certificate | [
"Create",
"a",
"new",
"Certificate",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequestSigner.php#L155-L165 |
224,011 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequestSigner.php | CertificateSigningRequestSigner.selfSign | public function selfSign(CertificateSigningRequest $csr, int $serial = 0): Certificate {
$certificate = openssl_csr_sign(
$csr->export(),
NULL,
$this->getPrivateKey(),
$this->getLifetime(),
$this->getOptions(),
$serial
);
re... | php | public function selfSign(CertificateSigningRequest $csr, int $serial = 0): Certificate {
$certificate = openssl_csr_sign(
$csr->export(),
NULL,
$this->getPrivateKey(),
$this->getLifetime(),
$this->getOptions(),
$serial
);
re... | [
"public",
"function",
"selfSign",
"(",
"CertificateSigningRequest",
"$",
"csr",
",",
"int",
"$",
"serial",
"=",
"0",
")",
":",
"Certificate",
"{",
"$",
"certificate",
"=",
"openssl_csr_sign",
"(",
"$",
"csr",
"->",
"export",
"(",
")",
",",
"NULL",
",",
"... | Create a self signed certificate.
@param CertificateSigningRequest $csr
@param int $serial
@return Certificate | [
"Create",
"a",
"self",
"signed",
"certificate",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequestSigner.php#L175-L185 |
224,012 | adamlc/address-format | src/Adamlc/AddressFormat/PopulateLocales.php | PopulateLocales.fetchData | public function fetchData()
{
$locales = json_decode(file_get_contents($this->locale_data_url));
if (isset($locales->countries)) {
//For some reason the countries are seperated by a tilde
$countries = explode('~', $locales->countries);
$data_dir = __DIR__ . '/i1... | php | public function fetchData()
{
$locales = json_decode(file_get_contents($this->locale_data_url));
if (isset($locales->countries)) {
//For some reason the countries are seperated by a tilde
$countries = explode('~', $locales->countries);
$data_dir = __DIR__ . '/i1... | [
"public",
"function",
"fetchData",
"(",
")",
"{",
"$",
"locales",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"locale_data_url",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"locales",
"->",
"countries",
")",
")",
"{",
"//For so... | Function to fetch data from Google API and populate local files.
@access public
@return void | [
"Function",
"to",
"fetch",
"data",
"from",
"Google",
"API",
"and",
"populate",
"local",
"files",
"."
] | 130d8276d5cd8bf5cc046e00ccc4c59a3a8b8ac8 | https://github.com/adamlc/address-format/blob/130d8276d5cd8bf5cc046e00ccc4c59a3a8b8ac8/src/Adamlc/AddressFormat/PopulateLocales.php#L26-L43 |
224,013 | Eluinhost/minecraft-auth | src/AuthServer/AuthServer.php | AuthServer.onConnection | public function onConnection(AuthClient $connection)
{
//bubble the events up
$connection->on('login_success', function(AuthClient $client, DisconnectPacket $packet) {
$this->emit('login_success', [$client->getUsername(), $client->getUUID(), $packet]);
});
$connection->o... | php | public function onConnection(AuthClient $connection)
{
//bubble the events up
$connection->on('login_success', function(AuthClient $client, DisconnectPacket $packet) {
$this->emit('login_success', [$client->getUsername(), $client->getUUID(), $packet]);
});
$connection->o... | [
"public",
"function",
"onConnection",
"(",
"AuthClient",
"$",
"connection",
")",
"{",
"//bubble the events up",
"$",
"connection",
"->",
"on",
"(",
"'login_success'",
",",
"function",
"(",
"AuthClient",
"$",
"client",
",",
"DisconnectPacket",
"$",
"packet",
")",
... | Called on event 'connection'
@param AuthClient $connection | [
"Called",
"on",
"event",
"connection"
] | ebe9a09d1de45dbc765545137514c8cf7c8e075f | https://github.com/Eluinhost/minecraft-auth/blob/ebe9a09d1de45dbc765545137514c8cf7c8e075f/src/AuthServer/AuthServer.php#L70-L110 |
224,014 | sgomez/SSPGuardBundle | SimpleSAMLphp/AuthSourceRegistry.php | AuthSourceRegistry.getAuthSource | public function getAuthSource($key)
{
if (!isset($this->authSources[$key])) {
throw new \InvalidArgumentException(sprintf(
'There is no AuthSource called "%s". Available are: %s',
$key,
implode(', ', array_keys($this->authSources))
));
... | php | public function getAuthSource($key)
{
if (!isset($this->authSources[$key])) {
throw new \InvalidArgumentException(sprintf(
'There is no AuthSource called "%s". Available are: %s',
$key,
implode(', ', array_keys($this->authSources))
));
... | [
"public",
"function",
"getAuthSource",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"authSources",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'There is no Au... | Get SSPAuthSource.
@param $key
@return SSPAuthSource | [
"Get",
"SSPAuthSource",
"."
] | 9655bfdb62e0321b9929209587f5eaab8cc6a38b | https://github.com/sgomez/SSPGuardBundle/blob/9655bfdb62e0321b9929209587f5eaab8cc6a38b/SimpleSAMLphp/AuthSourceRegistry.php#L47-L58 |
224,015 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.rules | public function rules($ruleset)
{
if (! is_array($ruleset)) {
$ruleset = [static::GLOBAL_KEY => $ruleset];
}
foreach ($ruleset as $key => $rules) {
$this->addRule($key, $rules);
}
return $this;
} | php | public function rules($ruleset)
{
if (! is_array($ruleset)) {
$ruleset = [static::GLOBAL_KEY => $ruleset];
}
foreach ($ruleset as $key => $rules) {
$this->addRule($key, $rules);
}
return $this;
} | [
"public",
"function",
"rules",
"(",
"$",
"ruleset",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"ruleset",
")",
")",
"{",
"$",
"ruleset",
"=",
"[",
"static",
"::",
"GLOBAL_KEY",
"=>",
"$",
"ruleset",
"]",
";",
"}",
"foreach",
"(",
"$",
"ruleset... | Add rules to the sanitizer.
@param string|array $ruleset The sanitation rules.
@return \Alfheim\Sanitizer\Sanitizer $this | [
"Add",
"rules",
"to",
"the",
"sanitizer",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L52-L63 |
224,016 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.sanitize | public function sanitize($data)
{
if ($this->hasGlobals()) {
if (! is_array($data)) {
return $this->sanitizeValueFor(static::GLOBAL_KEY, $data);
}
foreach ($data as $key => $value) {
$data[$key] = $this->sanitizeValueFor(static::GLOBAL_KEY... | php | public function sanitize($data)
{
if ($this->hasGlobals()) {
if (! is_array($data)) {
return $this->sanitizeValueFor(static::GLOBAL_KEY, $data);
}
foreach ($data as $key => $value) {
$data[$key] = $this->sanitizeValueFor(static::GLOBAL_KEY... | [
"public",
"function",
"sanitize",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasGlobals",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sanitizeValueFor",
"(",
"static... | Sanitize some data.
@param mixed $data
@return mixed | [
"Sanitize",
"some",
"data",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L72-L93 |
224,017 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.sanitizeValueFor | protected function sanitizeValueFor($key, $value)
{
foreach ($this->rules[$key] as $rule) {
$value = call_user_func_array(
$this->getCallable($rule[0], $key),
$this->buildArguments($value, isset($rule[1]) ? $rule[1] : null)
);
}
return... | php | protected function sanitizeValueFor($key, $value)
{
foreach ($this->rules[$key] as $rule) {
$value = call_user_func_array(
$this->getCallable($rule[0], $key),
$this->buildArguments($value, isset($rule[1]) ? $rule[1] : null)
);
}
return... | [
"protected",
"function",
"sanitizeValueFor",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"rules",
"[",
"$",
"key",
"]",
"as",
"$",
"rule",
")",
"{",
"$",
"value",
"=",
"call_user_func_array",
"(",
"$",
"this",
"->... | Sanitize a single value for a given key.
@param string $key
@param mixed $value
@return mixed | [
"Sanitize",
"a",
"single",
"value",
"for",
"a",
"given",
"key",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L159-L169 |
224,018 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.getCallable | protected function getCallable($value, $key)
{
// If the value is a string, a registrar is set and the value is
// registred with the registrar, resolve it there.
if (
is_string($value) &&
$this->hasRegistrar() &&
$this->registrar->isRegistred($value)
... | php | protected function getCallable($value, $key)
{
// If the value is a string, a registrar is set and the value is
// registred with the registrar, resolve it there.
if (
is_string($value) &&
$this->hasRegistrar() &&
$this->registrar->isRegistred($value)
... | [
"protected",
"function",
"getCallable",
"(",
"$",
"value",
",",
"$",
"key",
")",
"{",
"// If the value is a string, a registrar is set and the value is",
"// registred with the registrar, resolve it there.",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"$",
"this... | Resolve the callable for a given rule.
@param mixed $value
@param string $key
@return callable
@throws \InvalidArgumentException | [
"Resolve",
"the",
"callable",
"for",
"a",
"given",
"rule",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L181-L210 |
224,019 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.buildArguments | protected function buildArguments($value, array $args = null)
{
if (! $args) {
return (array) $value;
}
$valuePosition = array_search(static::PLACEHOLDER_VALUE, $args, true);
if ($valuePosition === false) {
return array_merge((array) $value, $args);
... | php | protected function buildArguments($value, array $args = null)
{
if (! $args) {
return (array) $value;
}
$valuePosition = array_search(static::PLACEHOLDER_VALUE, $args, true);
if ($valuePosition === false) {
return array_merge((array) $value, $args);
... | [
"protected",
"function",
"buildArguments",
"(",
"$",
"value",
",",
"array",
"$",
"args",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"args",
")",
"{",
"return",
"(",
"array",
")",
"$",
"value",
";",
"}",
"$",
"valuePosition",
"=",
"array_search",
"("... | Build the arguments for a callback.
@param mixed $value
@param array|null $args
@return array | [
"Build",
"the",
"arguments",
"for",
"a",
"callback",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L220-L235 |
224,020 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.addRule | protected function addRule($key, $rules)
{
if ($this->shouldSanitize($key)) {
throw new InvalidArgumentException(sprintf(
'Sanitation rules are already defined for field [%s]', $key
));
}
$this->rules[$key] = $this->buildRules($rules);
} | php | protected function addRule($key, $rules)
{
if ($this->shouldSanitize($key)) {
throw new InvalidArgumentException(sprintf(
'Sanitation rules are already defined for field [%s]', $key
));
}
$this->rules[$key] = $this->buildRules($rules);
} | [
"protected",
"function",
"addRule",
"(",
"$",
"key",
",",
"$",
"rules",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldSanitize",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Sanitation rules are already ... | Add a rule to the sanitizer factory.
@param string $key
@param string|array|\Closure $rules
@return void
@throws \InvalidArgumentException | [
"Add",
"a",
"rule",
"to",
"the",
"sanitizer",
"factory",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L247-L256 |
224,021 | kalfheim/sanitizer | src/Sanitizer.php | Sanitizer.buildRules | protected function buildRules($rules)
{
if (is_string($rules)) {
$rules = explode('|', $rules);
} elseif (is_object($rules)) {
$rules = [$rules];
}
$built = [];
foreach ((array) $rules as $rule) {
if (is_string($rule) && strpos($rule, ':'... | php | protected function buildRules($rules)
{
if (is_string($rules)) {
$rules = explode('|', $rules);
} elseif (is_object($rules)) {
$rules = [$rules];
}
$built = [];
foreach ((array) $rules as $rule) {
if (is_string($rule) && strpos($rule, ':'... | [
"protected",
"function",
"buildRules",
"(",
"$",
"rules",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"rules",
")",
")",
"{",
"$",
"rules",
"=",
"explode",
"(",
"'|'",
",",
"$",
"rules",
")",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"rules",... | Build a valid set of rules.
@param string|array|\Closure $rules
@return array | [
"Build",
"a",
"valid",
"set",
"of",
"rules",
"."
] | 67aa0df0d1fcdc292d1904ce4e7618232bea964e | https://github.com/kalfheim/sanitizer/blob/67aa0df0d1fcdc292d1904ce4e7618232bea964e/src/Sanitizer.php#L265-L287 |
224,022 | blar/openssl | lib/Blar/OpenSSL/OpenSSL.php | OpenSSL.getStrongPseudoRandomBytes | public static function getStrongPseudoRandomBytes(int $length): string {
$result = openssl_random_pseudo_bytes($length, $strong);
if(!$strong) {
throw new RuntimeException('Not strong enough');
}
return $result;
} | php | public static function getStrongPseudoRandomBytes(int $length): string {
$result = openssl_random_pseudo_bytes($length, $strong);
if(!$strong) {
throw new RuntimeException('Not strong enough');
}
return $result;
} | [
"public",
"static",
"function",
"getStrongPseudoRandomBytes",
"(",
"int",
"$",
"length",
")",
":",
"string",
"{",
"$",
"result",
"=",
"openssl_random_pseudo_bytes",
"(",
"$",
"length",
",",
"$",
"strong",
")",
";",
"if",
"(",
"!",
"$",
"strong",
")",
"{",
... | Get strong random bytes.
@param int $length
@return string | [
"Get",
"strong",
"random",
"bytes",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/OpenSSL.php#L33-L39 |
224,023 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequest.php | CertificateSigningRequest.export | public function export(bool $verbose = false): string {
openssl_csr_export($this->getHandle(), $output, !$verbose);
return $output;
} | php | public function export(bool $verbose = false): string {
openssl_csr_export($this->getHandle(), $output, !$verbose);
return $output;
} | [
"public",
"function",
"export",
"(",
"bool",
"$",
"verbose",
"=",
"false",
")",
":",
"string",
"{",
"openssl_csr_export",
"(",
"$",
"this",
"->",
"getHandle",
"(",
")",
",",
"$",
"output",
",",
"!",
"$",
"verbose",
")",
";",
"return",
"$",
"output",
... | Export as string.
@param bool $verbose Add additional text output.
@return string | [
"Export",
"as",
"string",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequest.php#L54-L57 |
224,024 | blar/openssl | lib/Blar/OpenSSL/CertificateSigningRequest.php | CertificateSigningRequest.exportToFile | public function exportToFile(string $fileName, bool $verbose = false) {
openssl_csr_export_to_file($this->getHandle(), $fileName, !$verbose);
} | php | public function exportToFile(string $fileName, bool $verbose = false) {
openssl_csr_export_to_file($this->getHandle(), $fileName, !$verbose);
} | [
"public",
"function",
"exportToFile",
"(",
"string",
"$",
"fileName",
",",
"bool",
"$",
"verbose",
"=",
"false",
")",
"{",
"openssl_csr_export_to_file",
"(",
"$",
"this",
"->",
"getHandle",
"(",
")",
",",
"$",
"fileName",
",",
"!",
"$",
"verbose",
")",
"... | Export to a file.
@param string $fileName
@param bool $verbose Add additional text output. | [
"Export",
"to",
"a",
"file",
"."
] | 9a7faf31492cefe8c8b166ef775a6e2eba04c3ec | https://github.com/blar/openssl/blob/9a7faf31492cefe8c8b166ef775a6e2eba04c3ec/lib/Blar/OpenSSL/CertificateSigningRequest.php#L65-L67 |
224,025 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.getPaginated | public function getPaginated($paged = 15, $orderBy = 'created_at', $sort = 'desc')
{
$query = function () use ($paged, $orderBy, $sort) {
return $this->model
->with($this->requiredRelationships)
->orderBy($orderBy, $sort)
->paginate($paged);
... | php | public function getPaginated($paged = 15, $orderBy = 'created_at', $sort = 'desc')
{
$query = function () use ($paged, $orderBy, $sort) {
return $this->model
->with($this->requiredRelationships)
->orderBy($orderBy, $sort)
->paginate($paged);
... | [
"public",
"function",
"getPaginated",
"(",
"$",
"paged",
"=",
"15",
",",
"$",
"orderBy",
"=",
"'created_at'",
",",
"$",
"sort",
"=",
"'desc'",
")",
"{",
"$",
"query",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"paged",
",",
"$",
"orderBy",
",",
"$... | Get paged items
@param integer $paged Items per page
@param string $orderBy Column to sort by
@param string $sort Sort direction
@return \Illuminate\Pagination\Paginator | [
"Get",
"paged",
"items"
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L78-L89 |
224,026 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.getForSelect | public function getForSelect($data, $key = 'id', $orderBy = 'created_at', $sort = 'desc')
{
$query = function () use ($data, $key, $orderBy, $sort) {
return $this->model
->with($this->requiredRelationships)
->orderBy($orderBy, $sort)
->lists($data,... | php | public function getForSelect($data, $key = 'id', $orderBy = 'created_at', $sort = 'desc')
{
$query = function () use ($data, $key, $orderBy, $sort) {
return $this->model
->with($this->requiredRelationships)
->orderBy($orderBy, $sort)
->lists($data,... | [
"public",
"function",
"getForSelect",
"(",
"$",
"data",
",",
"$",
"key",
"=",
"'id'",
",",
"$",
"orderBy",
"=",
"'created_at'",
",",
"$",
"sort",
"=",
"'desc'",
")",
"{",
"$",
"query",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"data",
",",
"$",
... | Items for select options
@param string $data column to display in the option
@param string $key column to be used as the value in option
@param string $orderBy column to sort by
@param string $sort sort direction
@return array array with key value pairs | [
"Items",
"for",
"select",
"options"
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L100-L111 |
224,027 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.getById | public function getById($id)
{
$query = function () use ($id) {
return $this->model
->with($this->requiredRelationships)
->find($id);
};
return $this->doQuery($query);
} | php | public function getById($id)
{
$query = function () use ($id) {
return $this->model
->with($this->requiredRelationships)
->find($id);
};
return $this->doQuery($query);
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
")",
"{",
"$",
"query",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"with",
"(",
"$",
"this",
"->",
"requiredRelationships",
")",
"->",
"fi... | Get item by its id
@param integer $id
@return \Illuminate\Database\Eloquent\Model | [
"Get",
"item",
"by",
"its",
"id"
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L119-L128 |
224,028 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.getActively | public function getActively($term, $column = 'slug')
{
if (is_numeric($term)) {
return $this->getById($term);
}
return $this->getItemByColumn($term, $column);
} | php | public function getActively($term, $column = 'slug')
{
if (is_numeric($term)) {
return $this->getById($term);
}
return $this->getItemByColumn($term, $column);
} | [
"public",
"function",
"getActively",
"(",
"$",
"term",
",",
"$",
"column",
"=",
"'slug'",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"term",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getById",
"(",
"$",
"term",
")",
";",
"}",
"return",
"$",
... | Get item by id or column
@param mixed $term id or term
@param string $column column to search
@return \Illuminate\Database\Eloquent\Model | [
"Get",
"item",
"by",
"id",
"or",
"column"
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L175-L182 |
224,029 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.update | public function update($id, array $data)
{
return $this->model->where($this->model->getKeyName(), $id)->update($data);
} | php | public function update($id, array $data)
{
return $this->model->where($this->model->getKeyName(), $id)->update($data);
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"where",
"(",
"$",
"this",
"->",
"model",
"->",
"getKeyName",
"(",
")",
",",
"$",
"id",
")",
"->",
"update",
"(",
"$"... | Update a record using the primary key.
@param $id mixed primary key
@param $data array | [
"Update",
"a",
"record",
"using",
"the",
"primary",
"key",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L201-L204 |
224,030 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.updateOrCreate | public function updateOrCreate(array $identifiers, array $data)
{
$existing = $this->model->where(array_only($data, $identifiers))->first();
if ($existing) {
$existing->update($data);
return $existing;
}
return $this->create($data);
} | php | public function updateOrCreate(array $identifiers, array $data)
{
$existing = $this->model->where(array_only($data, $identifiers))->first();
if ($existing) {
$existing->update($data);
return $existing;
}
return $this->create($data);
} | [
"public",
"function",
"updateOrCreate",
"(",
"array",
"$",
"identifiers",
",",
"array",
"$",
"data",
")",
"{",
"$",
"existing",
"=",
"$",
"this",
"->",
"model",
"->",
"where",
"(",
"array_only",
"(",
"$",
"data",
",",
"$",
"identifiers",
")",
")",
"->"... | Update or crate a record and return the entity
@param array $identifiers columns to search for
@param array $data
@return mixed | [
"Update",
"or",
"crate",
"a",
"record",
"and",
"return",
"the",
"entity"
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L213-L224 |
224,031 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.delete | public function delete($id)
{
return $this->model->where($this->model->getKeyName(), $id)->delete();
} | php | public function delete($id)
{
return $this->model->where($this->model->getKeyName(), $id)->delete();
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"where",
"(",
"$",
"this",
"->",
"model",
"->",
"getKeyName",
"(",
")",
",",
"$",
"id",
")",
"->",
"delete",
"(",
")",
";",
"}"
] | Delete a record by the primary key.
@param $id
@return bool | [
"Delete",
"a",
"record",
"by",
"the",
"primary",
"key",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L232-L235 |
224,032 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.with | public function with($relationships)
{
$this->requiredRelationships = [];
if ($relationships == 'all') {
$this->requiredRelationships = $this->relationships;
} elseif (is_array($relationships)) {
$this->requiredRelationships = array_filter($relationships, function ($... | php | public function with($relationships)
{
$this->requiredRelationships = [];
if ($relationships == 'all') {
$this->requiredRelationships = $this->relationships;
} elseif (is_array($relationships)) {
$this->requiredRelationships = array_filter($relationships, function ($... | [
"public",
"function",
"with",
"(",
"$",
"relationships",
")",
"{",
"$",
"this",
"->",
"requiredRelationships",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"relationships",
"==",
"'all'",
")",
"{",
"$",
"this",
"->",
"requiredRelationships",
"=",
"$",
"this",
"->... | Choose what relationships to return with query.
@param mixed $relationships
@return $this | [
"Choose",
"what",
"relationships",
"to",
"return",
"with",
"query",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L243-L258 |
224,033 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.doQuery | protected function doQuery($callback)
{
$previousMethod = debug_backtrace(null, 2)[1];
$methodName = $previousMethod['function'];
$arguments = $previousMethod['args'];
$result = $this->doBeforeQuery($callback, $methodName, $arguments);
return $this->doAfterQuery($result, $m... | php | protected function doQuery($callback)
{
$previousMethod = debug_backtrace(null, 2)[1];
$methodName = $previousMethod['function'];
$arguments = $previousMethod['args'];
$result = $this->doBeforeQuery($callback, $methodName, $arguments);
return $this->doAfterQuery($result, $m... | [
"protected",
"function",
"doQuery",
"(",
"$",
"callback",
")",
"{",
"$",
"previousMethod",
"=",
"debug_backtrace",
"(",
"null",
",",
"2",
")",
"[",
"1",
"]",
";",
"$",
"methodName",
"=",
"$",
"previousMethod",
"[",
"'function'",
"]",
";",
"$",
"arguments... | Perform the repository query.
@param $callback
@return mixed | [
"Perform",
"the",
"repository",
"query",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L266-L275 |
224,034 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.doBeforeQuery | private function doBeforeQuery($callback, $methodName, $arguments)
{
$traits = $this->getUsedTraits();
if (in_array(CacheResults::class, $traits) && $this->caching && $this->isCacheableMethod($methodName)) {
return $this->processCacheRequest($callback, $methodName, $arguments);
... | php | private function doBeforeQuery($callback, $methodName, $arguments)
{
$traits = $this->getUsedTraits();
if (in_array(CacheResults::class, $traits) && $this->caching && $this->isCacheableMethod($methodName)) {
return $this->processCacheRequest($callback, $methodName, $arguments);
... | [
"private",
"function",
"doBeforeQuery",
"(",
"$",
"callback",
",",
"$",
"methodName",
",",
"$",
"arguments",
")",
"{",
"$",
"traits",
"=",
"$",
"this",
"->",
"getUsedTraits",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"CacheResults",
"::",
"class",
",",
... | Apply any modifiers to the query.
@param $callback
@param $methodName
@param $arguments
@return mixed | [
"Apply",
"any",
"modifiers",
"to",
"the",
"query",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L285-L294 |
224,035 | dannyweeks/laravel-base-repository | src/BaseEloquentRepository.php | BaseEloquentRepository.doAfterQuery | private function doAfterQuery($result, $methodName, $arguments)
{
$traits = $this->getUsedTraits();
if (in_array(CacheResults::class, $traits)) {
// Reset caching to enabled in case it has just been disabled.
$this->caching = true;
}
if (in_array(ThrowsHttpE... | php | private function doAfterQuery($result, $methodName, $arguments)
{
$traits = $this->getUsedTraits();
if (in_array(CacheResults::class, $traits)) {
// Reset caching to enabled in case it has just been disabled.
$this->caching = true;
}
if (in_array(ThrowsHttpE... | [
"private",
"function",
"doAfterQuery",
"(",
"$",
"result",
",",
"$",
"methodName",
",",
"$",
"arguments",
")",
"{",
"$",
"traits",
"=",
"$",
"this",
"->",
"getUsedTraits",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"CacheResults",
"::",
"class",
",",
"... | Handle the query result.
@param $result
@param $methodName
@param $arguments
@return mixed | [
"Handle",
"the",
"query",
"result",
"."
] | 69f294898b98a10cb84b9a6f664e789a5ff24122 | https://github.com/dannyweeks/laravel-base-repository/blob/69f294898b98a10cb84b9a6f664e789a5ff24122/src/BaseEloquentRepository.php#L304-L323 |
224,036 | lexik/LexikMonologBrowserBundle | Model/LogRepository.php | LogRepository.getLogById | public function getLogById($id)
{
$log = $this->createQueryBuilder()
->select('l.*')
->from($this->tableName, 'l')
->where('l.id = :id')
->setParameter(':id', $id)
->execute()
->fetch();
... | php | public function getLogById($id)
{
$log = $this->createQueryBuilder()
->select('l.*')
->from($this->tableName, 'l')
->where('l.id = :id')
->setParameter(':id', $id)
->execute()
->fetch();
... | [
"public",
"function",
"getLogById",
"(",
"$",
"id",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'l.*'",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"tableName",
",",
"'l'",
")",
"->",
"where",
... | Retrieve a log entry by his ID.
@param integer $id
@return Log|null | [
"Retrieve",
"a",
"log",
"entry",
"by",
"his",
"ID",
"."
] | f9c7a9323763dc392e2b20aa995d44570f10bde4 | https://github.com/lexik/LexikMonologBrowserBundle/blob/f9c7a9323763dc392e2b20aa995d44570f10bde4/Model/LogRepository.php#L63-L76 |
224,037 | lexik/LexikMonologBrowserBundle | Model/LogRepository.php | LogRepository.getLastLog | public function getLastLog()
{
$log = $this->createQueryBuilder()
->select('l.*')
->from($this->tableName, 'l')
->orderBy('l.id', 'DESC')
->setMaxResults(1)
->execute()
->fetch();
... | php | public function getLastLog()
{
$log = $this->createQueryBuilder()
->select('l.*')
->from($this->tableName, 'l')
->orderBy('l.id', 'DESC')
->setMaxResults(1)
->execute()
->fetch();
... | [
"public",
"function",
"getLastLog",
"(",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'l.*'",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"tableName",
",",
"'l'",
")",
"->",
"orderBy",
"(",
"'l.id... | Retrieve last log entry.
@return Log|null | [
"Retrieve",
"last",
"log",
"entry",
"."
] | f9c7a9323763dc392e2b20aa995d44570f10bde4 | https://github.com/lexik/LexikMonologBrowserBundle/blob/f9c7a9323763dc392e2b20aa995d44570f10bde4/Model/LogRepository.php#L83-L96 |
224,038 | lexik/LexikMonologBrowserBundle | Model/LogRepository.php | LogRepository.getSimilarLogsQueryBuilder | public function getSimilarLogsQueryBuilder(Log $log)
{
return $this->createQueryBuilder()
->select('l.id, l.channel, l.level, l.level_name, l.message, l.datetime')
->from($this->tableName, 'l')
->andWhere('l.message = :message')
... | php | public function getSimilarLogsQueryBuilder(Log $log)
{
return $this->createQueryBuilder()
->select('l.id, l.channel, l.level, l.level_name, l.message, l.datetime')
->from($this->tableName, 'l')
->andWhere('l.message = :message')
... | [
"public",
"function",
"getSimilarLogsQueryBuilder",
"(",
"Log",
"$",
"log",
")",
"{",
"return",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'l.id, l.channel, l.level, l.level_name, l.message, l.datetime'",
")",
"->",
"from",
"(",
"$",
"t... | Retrieve similar logs of the given one.
@param Log $log
@return \Doctrine\DBAL\Query\QueryBuilder | [
"Retrieve",
"similar",
"logs",
"of",
"the",
"given",
"one",
"."
] | f9c7a9323763dc392e2b20aa995d44570f10bde4 | https://github.com/lexik/LexikMonologBrowserBundle/blob/f9c7a9323763dc392e2b20aa995d44570f10bde4/Model/LogRepository.php#L105-L118 |
224,039 | lexik/LexikMonologBrowserBundle | Model/LogRepository.php | LogRepository.getLogsLevel | public function getLogsLevel()
{
$levels = $this->createQueryBuilder()
->select('l.level, l.level_name, COUNT(l.id) AS count')
->from($this->tableName, 'l')
->groupBy('l.level, l.level_name')
->orderBy('l.level', 'DE... | php | public function getLogsLevel()
{
$levels = $this->createQueryBuilder()
->select('l.level, l.level_name, COUNT(l.id) AS count')
->from($this->tableName, 'l')
->groupBy('l.level, l.level_name')
->orderBy('l.level', 'DE... | [
"public",
"function",
"getLogsLevel",
"(",
")",
"{",
"$",
"levels",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'l.level, l.level_name, COUNT(l.id) AS count'",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"tableName",
",",
"'l'"... | Returns a array of levels with count entries used by logs.
@return array | [
"Returns",
"a",
"array",
"of",
"levels",
"with",
"count",
"entries",
"used",
"by",
"logs",
"."
] | f9c7a9323763dc392e2b20aa995d44570f10bde4 | https://github.com/lexik/LexikMonologBrowserBundle/blob/f9c7a9323763dc392e2b20aa995d44570f10bde4/Model/LogRepository.php#L125-L141 |
224,040 | sulu/SuluProductBundle | Controller/ProductMediaController.php | ProductMediaController.postAction | public function postAction(Request $request, $productId)
{
$locale = $this->getLocale($request);
$mediaId = $request->get('mediaId', '');
try {
$em = $this->getDoctrine()->getManager();
/** @var Product $product */
$product = $this->getProductManager()->f... | php | public function postAction(Request $request, $productId)
{
$locale = $this->getLocale($request);
$mediaId = $request->get('mediaId', '');
try {
$em = $this->getDoctrine()->getManager();
/** @var Product $product */
$product = $this->getProductManager()->f... | [
"public",
"function",
"postAction",
"(",
"Request",
"$",
"request",
",",
"$",
"productId",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
"$",
"request",
")",
";",
"$",
"mediaId",
"=",
"$",
"request",
"->",
"get",
"(",
"'mediaId'",
... | Adds a new media to the product.
@param Request $request
@param int $productId
@return Response | [
"Adds",
"a",
"new",
"media",
"to",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductMediaController.php#L69-L108 |
224,041 | sulu/SuluProductBundle | Controller/ProductMediaController.php | ProductMediaController.putAction | public function putAction(Request $request, $productId)
{
$mediaIds = $request->get('mediaIds');
if (null === $mediaIds || !is_array($mediaIds)) {
throw new ProductException('No media ids given.');
}
/** @var Product $product */
$product = $this->getProductRepos... | php | public function putAction(Request $request, $productId)
{
$mediaIds = $request->get('mediaIds');
if (null === $mediaIds || !is_array($mediaIds)) {
throw new ProductException('No media ids given.');
}
/** @var Product $product */
$product = $this->getProductRepos... | [
"public",
"function",
"putAction",
"(",
"Request",
"$",
"request",
",",
"$",
"productId",
")",
"{",
"$",
"mediaIds",
"=",
"$",
"request",
"->",
"get",
"(",
"'mediaIds'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"mediaIds",
"||",
"!",
"is_array",
"(",
... | Updates media of a product.
@param Request $request
@param int $productId
@throws EntityNotFoundException
@throws ProductException
@return Response | [
"Updates",
"media",
"of",
"a",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductMediaController.php#L121-L141 |
224,042 | sulu/SuluProductBundle | Controller/ProductMediaController.php | ProductMediaController.deleteAction | public function deleteAction($productId, $mediaId)
{
/** @var Product $product */
$product = $this->getProductRepository()->find($productId);
if (!$product) {
throw new EntityNotFoundException($this->getProductEntityName(), $productId);
}
$this->getProductMediaMa... | php | public function deleteAction($productId, $mediaId)
{
/** @var Product $product */
$product = $this->getProductRepository()->find($productId);
if (!$product) {
throw new EntityNotFoundException($this->getProductEntityName(), $productId);
}
$this->getProductMediaMa... | [
"public",
"function",
"deleteAction",
"(",
"$",
"productId",
",",
"$",
"mediaId",
")",
"{",
"/** @var Product $product */",
"$",
"product",
"=",
"$",
"this",
"->",
"getProductRepository",
"(",
")",
"->",
"find",
"(",
"$",
"productId",
")",
";",
"if",
"(",
... | Removes a media from the relation.
@param int $productId
@param int $mediaId
@throws EntityNotFoundException
@throws ProductException
@return Response | [
"Removes",
"a",
"media",
"from",
"the",
"relation",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductMediaController.php#L154-L168 |
224,043 | sulu/SuluProductBundle | Controller/ProductMediaController.php | ProductMediaController.removeDefaultPrices | private function removeDefaultPrices(Product $product)
{
$defaultPrices = [];
// get default prices
foreach ($product->getPrices() as $price) {
if ($price->getId() === null) {
$defaultPrices[] = $price;
}
}
foreach ($defaultPrices as ... | php | private function removeDefaultPrices(Product $product)
{
$defaultPrices = [];
// get default prices
foreach ($product->getPrices() as $price) {
if ($price->getId() === null) {
$defaultPrices[] = $price;
}
}
foreach ($defaultPrices as ... | [
"private",
"function",
"removeDefaultPrices",
"(",
"Product",
"$",
"product",
")",
"{",
"$",
"defaultPrices",
"=",
"[",
"]",
";",
"// get default prices",
"foreach",
"(",
"$",
"product",
"->",
"getPrices",
"(",
")",
"as",
"$",
"price",
")",
"{",
"if",
"(",... | Removes default prices from product.
@param Product $product | [
"Removes",
"default",
"prices",
"from",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductMediaController.php#L354-L368 |
224,044 | unreal4u/mqtt | src/Internals/EventManager.php | EventManager.analyzeHeaders | public function analyzeHeaders(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface
{
if ($rawMQTTHeaders === '') {
$this->logger->debug('Empty headers, returning an empty object');
return new EmptyReadableResponse($this->logger);
}
$controlPacke... | php | public function analyzeHeaders(string $rawMQTTHeaders, ClientInterface $client): ReadableContentInterface
{
if ($rawMQTTHeaders === '') {
$this->logger->debug('Empty headers, returning an empty object');
return new EmptyReadableResponse($this->logger);
}
$controlPacke... | [
"public",
"function",
"analyzeHeaders",
"(",
"string",
"$",
"rawMQTTHeaders",
",",
"ClientInterface",
"$",
"client",
")",
":",
"ReadableContentInterface",
"{",
"if",
"(",
"$",
"rawMQTTHeaders",
"===",
"''",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",... | Will check within all the Readable objects whether one of those is the correct packet we are looking for
@param string $rawMQTTHeaders Arbitrary size of minimum 1 incoming byte(s)
@param ClientInterface $client Used if the object itself needs to process some more stuff
@return ReadableContentInterface
@throws \DomainE... | [
"Will",
"check",
"within",
"all",
"the",
"Readable",
"objects",
"whether",
"one",
"of",
"those",
"is",
"the",
"correct",
"packet",
"we",
"are",
"looking",
"for"
] | 84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4 | https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/EventManager.php#L76-L99 |
224,045 | sulu/SuluProductBundle | Entity/BaseProduct.php | BaseProduct.isValidShopProduct | public function isValidShopProduct($defaultCurrency)
{
$isValid = false;
if (method_exists($this, 'getPrices') &&
$this->getStatus()->getId() == Status::ACTIVE &&
$this->getPrices() &&
count($this->getPrices()) > 0 &&
$this->hasPriceInDefaultCurrency(... | php | public function isValidShopProduct($defaultCurrency)
{
$isValid = false;
if (method_exists($this, 'getPrices') &&
$this->getStatus()->getId() == Status::ACTIVE &&
$this->getPrices() &&
count($this->getPrices()) > 0 &&
$this->hasPriceInDefaultCurrency(... | [
"public",
"function",
"isValidShopProduct",
"(",
"$",
"defaultCurrency",
")",
"{",
"$",
"isValid",
"=",
"false",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'getPrices'",
")",
"&&",
"$",
"this",
"->",
"getStatus",
"(",
")",
"->",
"getId",
"(... | Helper method to check if the product is
a valid shop product.
@param string $defaultCurrency
@return bool | [
"Helper",
"method",
"to",
"check",
"if",
"the",
"product",
"is",
"a",
"valid",
"shop",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/BaseProduct.php#L1103-L1118 |
224,046 | sulu/SuluProductBundle | Entity/BaseProduct.php | BaseProduct.hasPriceInDefaultCurrency | private function hasPriceInDefaultCurrency($prices, $defaultCurrency)
{
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() === $defaultCurrency) {
return true;
}
}
return false;
} | php | private function hasPriceInDefaultCurrency($prices, $defaultCurrency)
{
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() === $defaultCurrency) {
return true;
}
}
return false;
} | [
"private",
"function",
"hasPriceInDefaultCurrency",
"(",
"$",
"prices",
",",
"$",
"defaultCurrency",
")",
"{",
"foreach",
"(",
"$",
"prices",
"as",
"$",
"price",
")",
"{",
"if",
"(",
"$",
"price",
"->",
"getCurrency",
"(",
")",
"->",
"getCode",
"(",
")",... | Checks if price in default currency exists.
@param ProductPrice[] $prices
@param string $defaultCurrency
@return bool | [
"Checks",
"if",
"price",
"in",
"default",
"currency",
"exists",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Entity/BaseProduct.php#L1128-L1137 |
224,047 | laravelflare/mail-debug | src/MailDebug/Providers/RouteServiceProvider.php | RouteServiceProvider.registerRoutes | protected function registerRoutes(Router $router)
{
$debug = $this->app->make(MailDebugManager::class);
$router->get('mail-debug/{file}', function ($file) use ($debug) {
if (file_exists($path = $debug->storage().'/'.$file)) {
include $path;
return;
... | php | protected function registerRoutes(Router $router)
{
$debug = $this->app->make(MailDebugManager::class);
$router->get('mail-debug/{file}', function ($file) use ($debug) {
if (file_exists($path = $debug->storage().'/'.$file)) {
include $path;
return;
... | [
"protected",
"function",
"registerRoutes",
"(",
"Router",
"$",
"router",
")",
"{",
"$",
"debug",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"MailDebugManager",
"::",
"class",
")",
";",
"$",
"router",
"->",
"get",
"(",
"'mail-debug/{file}'",
",",
"... | Register the Mail Debug Routes.
@param Router $router | [
"Register",
"the",
"Mail",
"Debug",
"Routes",
"."
] | 337642f5afd6d585ccfe9fd16efa95a60db9500d | https://github.com/laravelflare/mail-debug/blob/337642f5afd6d585ccfe9fd16efa95a60db9500d/src/MailDebug/Providers/RouteServiceProvider.php#L51-L63 |
224,048 | sulu/SuluProductBundle | Product/Mapper/ProductContentMapper.php | ProductContentMapper.parseContentToArray | private function parseContentToArray(ProductTranslation $productTranslation)
{
$routePath = null;
if ($productTranslation->getRoute()) {
$routePath = $productTranslation->getRoute()->getPath();
}
return [
'title' => $productTranslation->getContentTitle(),
... | php | private function parseContentToArray(ProductTranslation $productTranslation)
{
$routePath = null;
if ($productTranslation->getRoute()) {
$routePath = $productTranslation->getRoute()->getPath();
}
return [
'title' => $productTranslation->getContentTitle(),
... | [
"private",
"function",
"parseContentToArray",
"(",
"ProductTranslation",
"$",
"productTranslation",
")",
"{",
"$",
"routePath",
"=",
"null",
";",
"if",
"(",
"$",
"productTranslation",
"->",
"getRoute",
"(",
")",
")",
"{",
"$",
"routePath",
"=",
"$",
"productTr... | Parses product content data to an array.
@param ProductTranslation $productTranslation
@return array | [
"Parses",
"product",
"content",
"data",
"to",
"an",
"array",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/Mapper/ProductContentMapper.php#L82-L93 |
224,049 | unreal4u/mqtt | src/DataTypes/TopicName.php | TopicName.setTopicName | private function setTopicName(string $topicName): self
{
$this->generalRulesCheck($topicName);
// A topic name has some additional checks, as no wildcard characters are allowed
if (strpbrk($topicName, '#+') !== false) {
throw new \InvalidArgumentException('Topic names can not co... | php | private function setTopicName(string $topicName): self
{
$this->generalRulesCheck($topicName);
// A topic name has some additional checks, as no wildcard characters are allowed
if (strpbrk($topicName, '#+') !== false) {
throw new \InvalidArgumentException('Topic names can not co... | [
"private",
"function",
"setTopicName",
"(",
"string",
"$",
"topicName",
")",
":",
"self",
"{",
"$",
"this",
"->",
"generalRulesCheck",
"(",
"$",
"topicName",
")",
";",
"// A topic name has some additional checks, as no wildcard characters are allowed",
"if",
"(",
"strpb... | Contains the name of the TopicFilter Filter
@param string $topicName
@return TopicName
@throws \OutOfBoundsException
@throws \InvalidArgumentException | [
"Contains",
"the",
"name",
"of",
"the",
"TopicFilter",
"Filter"
] | 84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4 | https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/DataTypes/TopicName.php#L42-L53 |
224,050 | ibuildingsnl/qa-tools | src/Core/Task/Executor/Sigints.php | Sigints.resetTrap | public static function resetTrap()
{
if (!self::$registered) {
throw new RuntimeException('Signal handler has not been registered');
}
if (!pcntl_signal_dispatch()) {
throw new RuntimeException(
sprintf('Call to pcntl_signal_dispatch() failed (PHP erro... | php | public static function resetTrap()
{
if (!self::$registered) {
throw new RuntimeException('Signal handler has not been registered');
}
if (!pcntl_signal_dispatch()) {
throw new RuntimeException(
sprintf('Call to pcntl_signal_dispatch() failed (PHP erro... | [
"public",
"static",
"function",
"resetTrap",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"registered",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Signal handler has not been registered'",
")",
";",
"}",
"if",
"(",
"!",
"pcntl_signal_dispatch",
... | Relinquish control to PHP.
@return void | [
"Relinquish",
"control",
"to",
"PHP",
"."
] | 0c4999a74c55b03a826e1c881f75ee3fba6329f7 | https://github.com/ibuildingsnl/qa-tools/blob/0c4999a74c55b03a826e1c881f75ee3fba6329f7/src/Core/Task/Executor/Sigints.php#L37-L57 |
224,051 | unreal4u/mqtt | src/Internals/PacketIdentifierFunctionality.php | PacketIdentifierFunctionality.setPacketIdentifierFromRawHeaders | final public function setPacketIdentifierFromRawHeaders(string $rawMQTTHeaders): self
{
$this->packetIdentifier = new PacketIdentifier(
Utilities::convertBinaryStringToNumber($rawMQTTHeaders{2} . $rawMQTTHeaders{3})
);
return $this;
} | php | final public function setPacketIdentifierFromRawHeaders(string $rawMQTTHeaders): self
{
$this->packetIdentifier = new PacketIdentifier(
Utilities::convertBinaryStringToNumber($rawMQTTHeaders{2} . $rawMQTTHeaders{3})
);
return $this;
} | [
"final",
"public",
"function",
"setPacketIdentifierFromRawHeaders",
"(",
"string",
"$",
"rawMQTTHeaders",
")",
":",
"self",
"{",
"$",
"this",
"->",
"packetIdentifier",
"=",
"new",
"PacketIdentifier",
"(",
"Utilities",
"::",
"convertBinaryStringToNumber",
"(",
"$",
"... | Sets the packet identifier straight from the raw MQTT headers
@param string $rawMQTTHeaders
@return self
@throws \OutOfRangeException | [
"Sets",
"the",
"packet",
"identifier",
"straight",
"from",
"the",
"raw",
"MQTT",
"headers"
] | 84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4 | https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/PacketIdentifierFunctionality.php#L56-L63 |
224,052 | unreal4u/mqtt | src/Internals/PacketIdentifierFunctionality.php | PacketIdentifierFunctionality.controlPacketIdentifiers | private function controlPacketIdentifiers(WritableContentInterface $originalRequest): bool
{
/** @var PacketIdentifierFunctionality $originalRequest */
if ($this->getPacketIdentifier() !== $originalRequest->getPacketIdentifier()) {
$e = new NonMatchingPacketIdentifiers('Packet identifier... | php | private function controlPacketIdentifiers(WritableContentInterface $originalRequest): bool
{
/** @var PacketIdentifierFunctionality $originalRequest */
if ($this->getPacketIdentifier() !== $originalRequest->getPacketIdentifier()) {
$e = new NonMatchingPacketIdentifiers('Packet identifier... | [
"private",
"function",
"controlPacketIdentifiers",
"(",
"WritableContentInterface",
"$",
"originalRequest",
")",
":",
"bool",
"{",
"/** @var PacketIdentifierFunctionality $originalRequest */",
"if",
"(",
"$",
"this",
"->",
"getPacketIdentifier",
"(",
")",
"!==",
"$",
"ori... | Checks whether the original request with the current stored packet identifier matches
@param WritableContentInterface $originalRequest
@throws NonMatchingPacketIdentifiers
@return bool | [
"Checks",
"whether",
"the",
"original",
"request",
"with",
"the",
"current",
"stored",
"packet",
"identifier",
"matches"
] | 84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4 | https://github.com/unreal4u/mqtt/blob/84f4c49b9e36c42b7e0ec8da0432c91ecb6530b4/src/Internals/PacketIdentifierFunctionality.php#L89-L100 |
224,053 | culturekings/afterpay | src/Service/InStore/Order.php | Order.createOrReverse | public function createOrReverse(
Model\InStore\Order $order,
Model\InStore\Reversal $orderReversal = null,
HandlerStack $stack = null
) {
try {
return $this->create($order, $stack);
} catch (ApiException $orderException) {
// http://docs.afterpay.com.a... | php | public function createOrReverse(
Model\InStore\Order $order,
Model\InStore\Reversal $orderReversal = null,
HandlerStack $stack = null
) {
try {
return $this->create($order, $stack);
} catch (ApiException $orderException) {
// http://docs.afterpay.com.a... | [
"public",
"function",
"createOrReverse",
"(",
"Model",
"\\",
"InStore",
"\\",
"Order",
"$",
"order",
",",
"Model",
"\\",
"InStore",
"\\",
"Reversal",
"$",
"orderReversal",
"=",
"null",
",",
"HandlerStack",
"$",
"stack",
"=",
"null",
")",
"{",
"try",
"{",
... | Helper method to automatically attempt to reverse an order if an error occurs.
Order reversal model does not have to be passed in and will be automatically generated if not.
@param Model\InStore\Order $order
@param Model\InStore\Reversal|null $orderReversal
@param HandlerStack|null $stack
@return M... | [
"Helper",
"method",
"to",
"automatically",
"attempt",
"to",
"reverse",
"an",
"order",
"if",
"an",
"error",
"occurs",
"."
] | d2fde2eed6d6102464ffd9d3bea7623f31e77a61 | https://github.com/culturekings/afterpay/blob/d2fde2eed6d6102464ffd9d3bea7623f31e77a61/src/Service/InStore/Order.php#L100-L146 |
224,054 | mrclay/shibalike | src/Shibalike/SP.php | SP.makeAuthRequest | public function makeAuthRequest($returnUrl = null)
{
if (empty($returnUrl)) {
$returnUrl = $this->getReturnUrl();
}
$this->_stateMgr->set('authRequest', new AuthRequest($returnUrl));
$this->_stateMgr->set('authResult');
} | php | public function makeAuthRequest($returnUrl = null)
{
if (empty($returnUrl)) {
$returnUrl = $this->getReturnUrl();
}
$this->_stateMgr->set('authRequest', new AuthRequest($returnUrl));
$this->_stateMgr->set('authResult');
} | [
"public",
"function",
"makeAuthRequest",
"(",
"$",
"returnUrl",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"returnUrl",
")",
")",
"{",
"$",
"returnUrl",
"=",
"$",
"this",
"->",
"getReturnUrl",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_stateM... | Instruct IdP that this user wishes to be authenticated
@param string $returnUrl if null, getReturnUrl() is used | [
"Instruct",
"IdP",
"that",
"this",
"user",
"wishes",
"to",
"be",
"authenticated"
] | 04242301ed18f5a1b02493bcc193f5efd255112e | https://github.com/mrclay/shibalike/blob/04242301ed18f5a1b02493bcc193f5efd255112e/src/Shibalike/SP.php#L78-L85 |
224,055 | mrclay/shibalike | src/Shibalike/SP.php | SP.createFileBased | public static function createFileBased($idpUrl, $cookieName = 'SHIBALIKE', $sessionPath = null)
{
if (empty($sessionPath)) {
$sessionPath = sys_get_temp_dir();
}
$session = SessionBuilder::instance()
->setName($cookieName)
->setSavePath($sessionPath)
->build();
$stateMgr = n... | php | public static function createFileBased($idpUrl, $cookieName = 'SHIBALIKE', $sessionPath = null)
{
if (empty($sessionPath)) {
$sessionPath = sys_get_temp_dir();
}
$session = SessionBuilder::instance()
->setName($cookieName)
->setSavePath($sessionPath)
->build();
$stateMgr = n... | [
"public",
"static",
"function",
"createFileBased",
"(",
"$",
"idpUrl",
",",
"$",
"cookieName",
"=",
"'SHIBALIKE'",
",",
"$",
"sessionPath",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sessionPath",
")",
")",
"{",
"$",
"sessionPath",
"=",
"sys_g... | Creates an SP that stores session data in files
@param string $idpUrl URL where the IdP class is used to handle SP auth requests
@param string $cookieName
@param string $sessionPath path where session files are stored
@return SP|false false if a UserlandSession already exists under this cookie name | [
"Creates",
"an",
"SP",
"that",
"stores",
"session",
"data",
"in",
"files"
] | 04242301ed18f5a1b02493bcc193f5efd255112e | https://github.com/mrclay/shibalike/blob/04242301ed18f5a1b02493bcc193f5efd255112e/src/Shibalike/SP.php#L119-L133 |
224,056 | sulu/SuluProductBundle | Product/CurrencyManager.php | CurrencyManager.findAll | public function findAll($locale)
{
$currencies = $this->currencyRepository->findAll();
array_walk(
$currencies,
function (&$currency) use ($locale) {
$currency = new Currency($currency, $locale);
}
);
return $currencies;
} | php | public function findAll($locale)
{
$currencies = $this->currencyRepository->findAll();
array_walk(
$currencies,
function (&$currency) use ($locale) {
$currency = new Currency($currency, $locale);
}
);
return $currencies;
} | [
"public",
"function",
"findAll",
"(",
"$",
"locale",
")",
"{",
"$",
"currencies",
"=",
"$",
"this",
"->",
"currencyRepository",
"->",
"findAll",
"(",
")",
";",
"array_walk",
"(",
"$",
"currencies",
",",
"function",
"(",
"&",
"$",
"currency",
")",
"use",
... | Find all currencies.
@param $locale
@return Currency[] | [
"Find",
"all",
"currencies",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/CurrencyManager.php#L39-L51 |
224,057 | sulu/SuluProductBundle | Product/CurrencyManager.php | CurrencyManager.findById | public function findById($id, $locale)
{
$currency = $this->currencyRepository->findById($id);
return new Currency($currency, $locale);
} | php | public function findById($id, $locale)
{
$currency = $this->currencyRepository->findById($id);
return new Currency($currency, $locale);
} | [
"public",
"function",
"findById",
"(",
"$",
"id",
",",
"$",
"locale",
")",
"{",
"$",
"currency",
"=",
"$",
"this",
"->",
"currencyRepository",
"->",
"findById",
"(",
"$",
"id",
")",
";",
"return",
"new",
"Currency",
"(",
"$",
"currency",
",",
"$",
"l... | Finds a currency by id and locale.
@param $id
@param $locale
@return \Sulu\Bundle\ProductBundle\Api\Currency | [
"Finds",
"a",
"currency",
"by",
"id",
"and",
"locale",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/CurrencyManager.php#L77-L82 |
224,058 | kesar/PhpOpenSubtitles | src/kesar/PhpOpenSubtitles/SubtitlesManager.php | SubtitlesManager.logIn | private function logIn()
{
$request = xmlrpc_encode_request(
"LogIn",
array($this->username, $this->password, $this->lang, $this->userAgent)
);
$response = $this->generateResponse($request);
if (($response && xmlrpc_is_fault($response))) {
trigger... | php | private function logIn()
{
$request = xmlrpc_encode_request(
"LogIn",
array($this->username, $this->password, $this->lang, $this->userAgent)
);
$response = $this->generateResponse($request);
if (($response && xmlrpc_is_fault($response))) {
trigger... | [
"private",
"function",
"logIn",
"(",
")",
"{",
"$",
"request",
"=",
"xmlrpc_encode_request",
"(",
"\"LogIn\"",
",",
"array",
"(",
"$",
"this",
"->",
"username",
",",
"$",
"this",
"->",
"password",
",",
"$",
"this",
"->",
"lang",
",",
"$",
"this",
"->",... | Log in the OpenSubtitles.org API | [
"Log",
"in",
"the",
"OpenSubtitles",
".",
"org",
"API"
] | 8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3 | https://github.com/kesar/PhpOpenSubtitles/blob/8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3/src/kesar/PhpOpenSubtitles/SubtitlesManager.php#L30-L48 |
224,059 | kesar/PhpOpenSubtitles | src/kesar/PhpOpenSubtitles/SubtitlesManager.php | SubtitlesManager.searchSubtitles | private function searchSubtitles($userToken, $movieToken, $fileSize)
{
$request = xmlrpc_encode_request(
"SearchSubtitles",
array(
$userToken,
array(
array('sublanguageid' => $this->lang, 'moviehash' => $movieToken, 'moviebytesize'... | php | private function searchSubtitles($userToken, $movieToken, $fileSize)
{
$request = xmlrpc_encode_request(
"SearchSubtitles",
array(
$userToken,
array(
array('sublanguageid' => $this->lang, 'moviehash' => $movieToken, 'moviebytesize'... | [
"private",
"function",
"searchSubtitles",
"(",
"$",
"userToken",
",",
"$",
"movieToken",
",",
"$",
"fileSize",
")",
"{",
"$",
"request",
"=",
"xmlrpc_encode_request",
"(",
"\"SearchSubtitles\"",
",",
"array",
"(",
"$",
"userToken",
",",
"array",
"(",
"array",
... | Search for a list of subtitles in opensubtitles.org
@param string $userToken
@param string $movieToken
@param int $fileSize
@return array | [
"Search",
"for",
"a",
"list",
"of",
"subtitles",
"in",
"opensubtitles",
".",
"org"
] | 8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3 | https://github.com/kesar/PhpOpenSubtitles/blob/8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3/src/kesar/PhpOpenSubtitles/SubtitlesManager.php#L64-L87 |
224,060 | amsgames/laravel-shop-gateway-paypal | src/GatewayPayPalExpress.php | GatewayPayPalExpress.onCallbackSuccess | public function onCallbackSuccess($order, $data = null)
{
$paymentId = is_array($data) ? $data['paymentId'] : $data->paymentId;
$payerId = is_array($data) ? $data['PayerID'] : $data->PayerID;
$this->statusCode = 'failed';
$this->detail = sprintf('Payment failed. Ref: %s', $pay... | php | public function onCallbackSuccess($order, $data = null)
{
$paymentId = is_array($data) ? $data['paymentId'] : $data->paymentId;
$payerId = is_array($data) ? $data['PayerID'] : $data->PayerID;
$this->statusCode = 'failed';
$this->detail = sprintf('Payment failed. Ref: %s', $pay... | [
"public",
"function",
"onCallbackSuccess",
"(",
"$",
"order",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"paymentId",
"=",
"is_array",
"(",
"$",
"data",
")",
"?",
"$",
"data",
"[",
"'paymentId'",
"]",
":",
"$",
"data",
"->",
"paymentId",
";",
"$",... | Called on callback.
@param Order $order Order.
@param mixed $data Request input from callback.
@return bool | [
"Called",
"on",
"callback",
"."
] | c0ba041bda3fdcc696e4a01278647f386e9d8715 | https://github.com/amsgames/laravel-shop-gateway-paypal/blob/c0ba041bda3fdcc696e4a01278647f386e9d8715/src/GatewayPayPalExpress.php#L170-L224 |
224,061 | amsgames/laravel-shop-gateway-paypal | src/GatewayPayPalExpress.php | GatewayPayPalExpress.setContext | private function setContext()
{
$this->apiContext = new ApiContext(new OAuthTokenCredential(
Config::get('services.paypal.client_id'),
Config::get('services.paypal.secret')
));
if (!Config::get('services.paypal.sandbox'))
$this->apiContext->setConfig(['mo... | php | private function setContext()
{
$this->apiContext = new ApiContext(new OAuthTokenCredential(
Config::get('services.paypal.client_id'),
Config::get('services.paypal.secret')
));
if (!Config::get('services.paypal.sandbox'))
$this->apiContext->setConfig(['mo... | [
"private",
"function",
"setContext",
"(",
")",
"{",
"$",
"this",
"->",
"apiContext",
"=",
"new",
"ApiContext",
"(",
"new",
"OAuthTokenCredential",
"(",
"Config",
"::",
"get",
"(",
"'services.paypal.client_id'",
")",
",",
"Config",
"::",
"get",
"(",
"'services.... | Setups contexts for api calls. | [
"Setups",
"contexts",
"for",
"api",
"calls",
"."
] | c0ba041bda3fdcc696e4a01278647f386e9d8715 | https://github.com/amsgames/laravel-shop-gateway-paypal/blob/c0ba041bda3fdcc696e4a01278647f386e9d8715/src/GatewayPayPalExpress.php#L229-L238 |
224,062 | mrclay/shibalike | src/Shibalike/Junction.php | Junction.getValidAuthResult | public function getValidAuthResult()
{
$authResult = $this->_stateMgr->get('authResult');
/* @var AuthResult $authResult */
if ($authResult && $authResult->isFresh($this->_config->timeout)) {
return $authResult;
}
return null;
} | php | public function getValidAuthResult()
{
$authResult = $this->_stateMgr->get('authResult');
/* @var AuthResult $authResult */
if ($authResult && $authResult->isFresh($this->_config->timeout)) {
return $authResult;
}
return null;
} | [
"public",
"function",
"getValidAuthResult",
"(",
")",
"{",
"$",
"authResult",
"=",
"$",
"this",
"->",
"_stateMgr",
"->",
"get",
"(",
"'authResult'",
")",
";",
"/* @var AuthResult $authResult */",
"if",
"(",
"$",
"authResult",
"&&",
"$",
"authResult",
"->",
"is... | Get the User object from the state manager
@return AuthResult|null | [
"Get",
"the",
"User",
"object",
"from",
"the",
"state",
"manager"
] | 04242301ed18f5a1b02493bcc193f5efd255112e | https://github.com/mrclay/shibalike/blob/04242301ed18f5a1b02493bcc193f5efd255112e/src/Shibalike/Junction.php#L37-L45 |
224,063 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.reset | public function reset()
{
$this->values = array();
$this->xlabel = null;
$this->ylabel = null;
$this->labels = array();
$this->titles = array();
$this->xrange = null;
$this->yrange = null;
$this->title = null;
} | php | public function reset()
{
$this->values = array();
$this->xlabel = null;
$this->ylabel = null;
$this->labels = array();
$this->titles = array();
$this->xrange = null;
$this->yrange = null;
$this->title = null;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"values",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"xlabel",
"=",
"null",
";",
"$",
"this",
"->",
"ylabel",
"=",
"null",
";",
"$",
"this",
"->",
"labels",
"=",
"array",
"(",
... | Reset all the values | [
"Reset",
"all",
"the",
"values"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L81-L91 |
224,064 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.sendInit | protected function sendInit()
{
$this->sendCommand('set grid');
if ($this->title) {
$this->sendCommand('set title "'.$this->title.'"');
}
if ($this->xlabel) {
$this->sendCommand('set xlabel "'.$this->xlabel.'"');
}
if ($this->timeFormat) {
... | php | protected function sendInit()
{
$this->sendCommand('set grid');
if ($this->title) {
$this->sendCommand('set title "'.$this->title.'"');
}
if ($this->xlabel) {
$this->sendCommand('set xlabel "'.$this->xlabel.'"');
}
if ($this->timeFormat) {
... | [
"protected",
"function",
"sendInit",
"(",
")",
"{",
"$",
"this",
"->",
"sendCommand",
"(",
"'set grid'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"title",
")",
"{",
"$",
"this",
"->",
"sendCommand",
"(",
"'set title \"'",
".",
"$",
"this",
"->",
"title"... | Create the pipe | [
"Create",
"the",
"pipe"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L181-L221 |
224,065 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.plot | public function plot($replot = false)
{
if ($replot) {
$this->sendCommand('replot');
} else {
$this->sendCommand('plot '.$this->getUsings());
}
$this->plotted = true;
$this->sendData();
} | php | public function plot($replot = false)
{
if ($replot) {
$this->sendCommand('replot');
} else {
$this->sendCommand('plot '.$this->getUsings());
}
$this->plotted = true;
$this->sendData();
} | [
"public",
"function",
"plot",
"(",
"$",
"replot",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"replot",
")",
"{",
"$",
"this",
"->",
"sendCommand",
"(",
"'replot'",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"sendCommand",
"(",
"'plot '",
".",
"$",... | Runs the plot to the given pipe | [
"Runs",
"the",
"plot",
"to",
"the",
"given",
"pipe"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L226-L235 |
224,066 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.addLabel | public function addLabel($x, $y, $text)
{
$this->labels[] = array($x, $y, $text);
return $this;
} | php | public function addLabel($x, $y, $text)
{
$this->labels[] = array($x, $y, $text);
return $this;
} | [
"public",
"function",
"addLabel",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"labels",
"[",
"]",
"=",
"array",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"text",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add a label text | [
"Add",
"a",
"label",
"text"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L364-L369 |
224,067 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.getUsings | protected function getUsings()
{
$usings = array();
for ($i=0; $i<count($this->values); $i++) {
$using = '"-" using 1:2 with '.$this->mode;
if (isset($this->titles[$i])) {
$using .= ' title "'.$this->titles[$i].'"';
}
$usings[] = $usin... | php | protected function getUsings()
{
$usings = array();
for ($i=0; $i<count($this->values); $i++) {
$using = '"-" using 1:2 with '.$this->mode;
if (isset($this->titles[$i])) {
$using .= ' title "'.$this->titles[$i].'"';
}
$usings[] = $usin... | [
"protected",
"function",
"getUsings",
"(",
")",
"{",
"$",
"usings",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"this",
"->",
"values",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"using",
... | Gets the "using" line | [
"Gets",
"the",
"using",
"line"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L384-L397 |
224,068 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.sendData | protected function sendData()
{
foreach ($this->values as $index => $data) {
foreach ($data as $xy) {
list($x, $y) = $xy;
$this->sendCommand($x.' '.$y);
}
$this->sendCommand('e');
}
} | php | protected function sendData()
{
foreach ($this->values as $index => $data) {
foreach ($data as $xy) {
list($x, $y) = $xy;
$this->sendCommand($x.' '.$y);
}
$this->sendCommand('e');
}
} | [
"protected",
"function",
"sendData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"index",
"=>",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"xy",
")",
"{",
"list",
"(",
"$",
"x",
",",
"$",
"y",
")",... | Sends all the command to the given pipe to give it the
current data | [
"Sends",
"all",
"the",
"command",
"to",
"the",
"given",
"pipe",
"to",
"give",
"it",
"the",
"current",
"data"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L403-L412 |
224,069 | Gregwar/GnuPlot | GnuPlot.php | GnuPlot.openPipe | protected function openPipe()
{
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'r')
);
$this->process = proc_open('gnuplot', $descriptorspec, $pipes);
if (!is_resource($this->process)) {
... | php | protected function openPipe()
{
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'r')
);
$this->process = proc_open('gnuplot', $descriptorspec, $pipes);
if (!is_resource($this->process)) {
... | [
"protected",
"function",
"openPipe",
"(",
")",
"{",
"$",
"descriptorspec",
"=",
"array",
"(",
"0",
"=>",
"array",
"(",
"'pipe'",
",",
"'r'",
")",
",",
"1",
"=>",
"array",
"(",
"'pipe'",
",",
"'w'",
")",
",",
"2",
"=>",
"array",
"(",
"'pipe'",
",",
... | Open the pipe | [
"Open",
"the",
"pipe"
] | 6277ca7dc0457ea118958fa149f091f14e23c1cb | https://github.com/Gregwar/GnuPlot/blob/6277ca7dc0457ea118958fa149f091f14e23c1cb/GnuPlot.php#L426-L442 |
224,070 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.getAction | public function getAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
$view = $this->responseGetById(
$id,
function ($id) use ($locale) {
/** @var Product $product */
... | php | public function getAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
$view = $this->responseGetById(
$id,
function ($id) use ($locale) {
/** @var Product $product */
... | [
"public",
"function",
"getAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getProductLocaleManager",
"(",
")",
"->",
"retrieveLocale",
"(",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
"$",
"req... | Retrieves and shows a product with the given ID.
@param Request $request
@param int $id product ID
@return Response | [
"Retrieves",
"and",
"shows",
"a",
"product",
"with",
"the",
"given",
"ID",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L89-L103 |
224,071 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.cgetAction | public function cgetAction(Request $request)
{
$filter = $this->getManager()->getFilters($request);
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
if ($request->get('flat') == 'true') {
$filterFieldDescriptors = $this->getM... | php | public function cgetAction(Request $request)
{
$filter = $this->getManager()->getFilters($request);
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
if ($request->get('flat') == 'true') {
$filterFieldDescriptors = $this->getM... | [
"public",
"function",
"cgetAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"getFilters",
"(",
"$",
"request",
")",
";",
"$",
"locale",
"=",
"$",
"this",
"->",
"getProductLocaleManage... | Returns a list of products.
@param Request $request
@return Response | [
"Returns",
"a",
"list",
"of",
"products",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L112-L145 |
224,072 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.flatResponse | protected function flatResponse(
Request $request,
$filter,
$filterFieldDescriptors,
$fieldDescriptors,
$entityName
) {
$listBuilder = $this->getListBuilder($entityName, $fieldDescriptors);
foreach ($filter as $key => $value) {
if (is_array($value... | php | protected function flatResponse(
Request $request,
$filter,
$filterFieldDescriptors,
$fieldDescriptors,
$entityName
) {
$listBuilder = $this->getListBuilder($entityName, $fieldDescriptors);
foreach ($filter as $key => $value) {
if (is_array($value... | [
"protected",
"function",
"flatResponse",
"(",
"Request",
"$",
"request",
",",
"$",
"filter",
",",
"$",
"filterFieldDescriptors",
",",
"$",
"fieldDescriptors",
",",
"$",
"entityName",
")",
"{",
"$",
"listBuilder",
"=",
"$",
"this",
"->",
"getListBuilder",
"(",
... | Processes the request for a flat response.
@param Request $request
@param array $filter
@param array $filterFieldDescriptors
@param array $fieldDescriptors
@param string $entityName
@return ListRepresentation | [
"Processes",
"the",
"request",
"for",
"a",
"flat",
"response",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L182-L242 |
224,073 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.putAction | public function putAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
try {
$product = $this->getManager()->save(
$request->request->all(),
$locale,
$this-... | php | public function putAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
try {
$product = $this->getManager()->save(
$request->request->all(),
$locale,
$this-... | [
"public",
"function",
"putAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getProductLocaleManager",
"(",
")",
"->",
"retrieveLocale",
"(",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
"$",
"req... | Change a product entry by the given product id.
@param Request $request
@param int $id product ID
@return Response | [
"Change",
"a",
"product",
"entry",
"by",
"the",
"given",
"product",
"id",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L252-L282 |
224,074 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.deleteAction | public function deleteAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
$delete = function ($id) use ($locale) {
try {
$this->getManager()->delete($id, $this->getUser()->getId());
... | php | public function deleteAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
$delete = function ($id) use ($locale) {
try {
$this->getManager()->delete($id, $this->getUser()->getId());
... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getProductLocaleManager",
"(",
")",
"->",
"retrieveLocale",
"(",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
"$",
"... | Delete a product with the given id.
@param Request $request
@param int $id product id
@return Response | [
"Delete",
"a",
"product",
"with",
"the",
"given",
"id",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L325-L339 |
224,075 | sulu/SuluProductBundle | Controller/ProductController.php | ProductController.patchAction | public function patchAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
try {
$product = $this->getManager()->partialUpdate(
$request->request->all(),
$locale,
... | php | public function patchAction(Request $request, $id)
{
$locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));
try {
$product = $this->getManager()->partialUpdate(
$request->request->all(),
$locale,
... | [
"public",
"function",
"patchAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getProductLocaleManager",
"(",
")",
"->",
"retrieveLocale",
"(",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
"$",
"r... | Make a partial update of a product.
@param Request $request
@param int $id
@return Response | [
"Make",
"a",
"partial",
"update",
"of",
"a",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Controller/ProductController.php#L357-L378 |
224,076 | sulu/SuluProductBundle | Api/Product.php | Product.getSupplier | public function getSupplier()
{
$values = null;
$supplier = $this->entity->getSupplier();
if ($supplier !== null) {
// Returns no api entity because it will cause a nesting level exception
$values = [
'id' => $supplier->getId(),
'name' ... | php | public function getSupplier()
{
$values = null;
$supplier = $this->entity->getSupplier();
if ($supplier !== null) {
// Returns no api entity because it will cause a nesting level exception
$values = [
'id' => $supplier->getId(),
'name' ... | [
"public",
"function",
"getSupplier",
"(",
")",
"{",
"$",
"values",
"=",
"null",
";",
"$",
"supplier",
"=",
"$",
"this",
"->",
"entity",
"->",
"getSupplier",
"(",
")",
";",
"if",
"(",
"$",
"supplier",
"!==",
"null",
")",
"{",
"// Returns no api entity bec... | Returns the supplier of the product.
@VirtualProperty
@SerializedName("supplier")
@return object The supplier of the product | [
"Returns",
"the",
"supplier",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L402-L415 |
224,077 | sulu/SuluProductBundle | Api/Product.php | Product.getParent | public function getParent()
{
$parent = $this->entity->getParent();
if (!$parent) {
return null;
}
return $this->productFactory->createApiEntity($parent, $this->locale);
} | php | public function getParent()
{
$parent = $this->entity->getParent();
if (!$parent) {
return null;
}
return $this->productFactory->createApiEntity($parent, $this->locale);
} | [
"public",
"function",
"getParent",
"(",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"entity",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"parent",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"productFactory",
... | Returns the parent of the product.
@VirtualProperty
@SerializedName("parent")
@return ProductInterface The parent of the product | [
"Returns",
"the",
"parent",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L495-L504 |
224,078 | sulu/SuluProductBundle | Api/Product.php | Product.setParent | public function setParent(Product $parent = null)
{
if ($parent != null) {
$this->entity->setParent($parent->getEntity());
} else {
$this->entity->setParent(null);
}
} | php | public function setParent(Product $parent = null)
{
if ($parent != null) {
$this->entity->setParent($parent->getEntity());
} else {
$this->entity->setParent(null);
}
} | [
"public",
"function",
"setParent",
"(",
"Product",
"$",
"parent",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"parent",
"!=",
"null",
")",
"{",
"$",
"this",
"->",
"entity",
"->",
"setParent",
"(",
"$",
"parent",
"->",
"getEntity",
"(",
")",
")",
";",
"}... | Sets the parent of the product.
@param Product $parent The parent of the product | [
"Sets",
"the",
"parent",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L511-L518 |
224,079 | sulu/SuluProductBundle | Api/Product.php | Product.getType | public function getType()
{
if ($this->entity->getType()) {
return new Type($this->entity->getType(), $this->locale);
}
return null;
} | php | public function getType()
{
if ($this->entity->getType()) {
return new Type($this->entity->getType(), $this->locale);
}
return null;
} | [
"public",
"function",
"getType",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"entity",
"->",
"getType",
"(",
")",
")",
"{",
"return",
"new",
"Type",
"(",
"$",
"this",
"->",
"entity",
"->",
"getType",
"(",
")",
",",
"$",
"this",
"->",
"locale",
"... | Returns the type of the product.
@VirtualProperty
@SerializedName("type")
@return Type|null The type of the product | [
"Returns",
"the",
"type",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L548-L555 |
224,080 | sulu/SuluProductBundle | Api/Product.php | Product.getDeliveryStatus | public function getDeliveryStatus()
{
$status = $this->entity->getDeliveryStatus();
if ($status !== null) {
return new DeliveryStatus($status, $this->locale);
}
return null;
} | php | public function getDeliveryStatus()
{
$status = $this->entity->getDeliveryStatus();
if ($status !== null) {
return new DeliveryStatus($status, $this->locale);
}
return null;
} | [
"public",
"function",
"getDeliveryStatus",
"(",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"entity",
"->",
"getDeliveryStatus",
"(",
")",
";",
"if",
"(",
"$",
"status",
"!==",
"null",
")",
"{",
"return",
"new",
"DeliveryStatus",
"(",
"$",
"status",... | Returns the delivery status of the product.
@VirtualProperty
@SerializedName("deliveryStatus")
@return DeliveryStatus The delivery status of the product | [
"Returns",
"the",
"delivery",
"status",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L598-L606 |
224,081 | sulu/SuluProductBundle | Api/Product.php | Product.getOrderUnit | public function getOrderUnit()
{
$unit = $this->entity->getOrderUnit();
if (!is_null($unit)) {
return new Unit($unit, $this->locale);
}
return null;
} | php | public function getOrderUnit()
{
$unit = $this->entity->getOrderUnit();
if (!is_null($unit)) {
return new Unit($unit, $this->locale);
}
return null;
} | [
"public",
"function",
"getOrderUnit",
"(",
")",
"{",
"$",
"unit",
"=",
"$",
"this",
"->",
"entity",
"->",
"getOrderUnit",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"unit",
")",
")",
"{",
"return",
"new",
"Unit",
"(",
"$",
"unit",
",",
"... | Returns the orderUnit of the product.
@VirtualProperty
@SerializedName("orderUnit")
@Groups({"cart"})
@return Unit | [
"Returns",
"the",
"orderUnit",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L627-L635 |
224,082 | sulu/SuluProductBundle | Api/Product.php | Product.getContentUnit | public function getContentUnit()
{
$unit = $this->entity->getContentUnit();
if (!is_null($unit)) {
return new Unit($unit, $this->locale);
}
return null;
} | php | public function getContentUnit()
{
$unit = $this->entity->getContentUnit();
if (!is_null($unit)) {
return new Unit($unit, $this->locale);
}
return null;
} | [
"public",
"function",
"getContentUnit",
"(",
")",
"{",
"$",
"unit",
"=",
"$",
"this",
"->",
"entity",
"->",
"getContentUnit",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"unit",
")",
")",
"{",
"return",
"new",
"Unit",
"(",
"$",
"unit",
",",... | Returns the contentUnit of the product.
@VirtualProperty
@SerializedName("contentUnit")
@Groups({"cart"})
@return Unit | [
"Returns",
"the",
"contentUnit",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L656-L664 |
224,083 | sulu/SuluProductBundle | Api/Product.php | Product.getTaxClass | public function getTaxClass()
{
$taxClass = $this->entity->getTaxClass();
if ($taxClass) {
return new TaxClass($this->entity->getTaxClass(), $this->locale);
}
return null;
} | php | public function getTaxClass()
{
$taxClass = $this->entity->getTaxClass();
if ($taxClass) {
return new TaxClass($this->entity->getTaxClass(), $this->locale);
}
return null;
} | [
"public",
"function",
"getTaxClass",
"(",
")",
"{",
"$",
"taxClass",
"=",
"$",
"this",
"->",
"entity",
"->",
"getTaxClass",
"(",
")",
";",
"if",
"(",
"$",
"taxClass",
")",
"{",
"return",
"new",
"TaxClass",
"(",
"$",
"this",
"->",
"entity",
"->",
"get... | Returns the tax class of the product.
@VirtualProperty
@SerializedName("taxClass")
@return TaxClass The status of the product | [
"Returns",
"the",
"tax",
"class",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L684-L692 |
224,084 | sulu/SuluProductBundle | Api/Product.php | Product.getAttributeSet | public function getAttributeSet()
{
$attributeSet = $this->entity->getAttributeSet();
if ($attributeSet) {
return new AttributeSet($attributeSet, $this->locale);
}
return null;
} | php | public function getAttributeSet()
{
$attributeSet = $this->entity->getAttributeSet();
if ($attributeSet) {
return new AttributeSet($attributeSet, $this->locale);
}
return null;
} | [
"public",
"function",
"getAttributeSet",
"(",
")",
"{",
"$",
"attributeSet",
"=",
"$",
"this",
"->",
"entity",
"->",
"getAttributeSet",
"(",
")",
";",
"if",
"(",
"$",
"attributeSet",
")",
"{",
"return",
"new",
"AttributeSet",
"(",
"$",
"attributeSet",
",",... | Returns the attribute set of the product.
@VirtualProperty
@SerializedName("attributeSet")
@return AttributeSet The attribute set of the product | [
"Returns",
"the",
"attribute",
"set",
"of",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L712-L720 |
224,085 | sulu/SuluProductBundle | Api/Product.php | Product.getPrices | public function getPrices()
{
$priceEntities = $this->entity->getPrices();
$prices = [];
foreach ($priceEntities as $priceEntity) {
$prices[] = new ProductPrice($priceEntity, $this->locale);
}
return $prices;
} | php | public function getPrices()
{
$priceEntities = $this->entity->getPrices();
$prices = [];
foreach ($priceEntities as $priceEntity) {
$prices[] = new ProductPrice($priceEntity, $this->locale);
}
return $prices;
} | [
"public",
"function",
"getPrices",
"(",
")",
"{",
"$",
"priceEntities",
"=",
"$",
"this",
"->",
"entity",
"->",
"getPrices",
"(",
")",
";",
"$",
"prices",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"priceEntities",
"as",
"$",
"priceEntity",
")",
"{",
"... | Returns the prices for the product.
@VirtualProperty
@SerializedName("prices")
@return ProductPrice[] | [
"Returns",
"the",
"prices",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L750-L760 |
224,086 | sulu/SuluProductBundle | Api/Product.php | Product.getScalePriceForCurrency | public function getScalePriceForCurrency($currency = 'EUR')
{
$scalePrice = null;
$prices = $this->entity->getPrices();
if ($prices) {
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() == $currency) {
$scalePrice[] = $price;
... | php | public function getScalePriceForCurrency($currency = 'EUR')
{
$scalePrice = null;
$prices = $this->entity->getPrices();
if ($prices) {
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() == $currency) {
$scalePrice[] = $price;
... | [
"public",
"function",
"getScalePriceForCurrency",
"(",
"$",
"currency",
"=",
"'EUR'",
")",
"{",
"$",
"scalePrice",
"=",
"null",
";",
"$",
"prices",
"=",
"$",
"this",
"->",
"entity",
"->",
"getPrices",
"(",
")",
";",
"if",
"(",
"$",
"prices",
")",
"{",
... | Returns the scale price for a certain currency.
@param string $currency
@return ProductPrice[] | [
"Returns",
"the",
"scale",
"price",
"for",
"a",
"certain",
"currency",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L769-L782 |
224,087 | sulu/SuluProductBundle | Api/Product.php | Product.getFormattedSpecialPriceForCurrency | public function getFormattedSpecialPriceForCurrency($currency = 'EUR', $formatterLocale = null)
{
$price = $this->getSpecialPriceForCurrency($currency);
if ($price) {
return $this->getFormattedPrice($price->getPrice(), $currency, $formatterLocale);
}
return '';
} | php | public function getFormattedSpecialPriceForCurrency($currency = 'EUR', $formatterLocale = null)
{
$price = $this->getSpecialPriceForCurrency($currency);
if ($price) {
return $this->getFormattedPrice($price->getPrice(), $currency, $formatterLocale);
}
return '';
} | [
"public",
"function",
"getFormattedSpecialPriceForCurrency",
"(",
"$",
"currency",
"=",
"'EUR'",
",",
"$",
"formatterLocale",
"=",
"null",
")",
"{",
"$",
"price",
"=",
"$",
"this",
"->",
"getSpecialPriceForCurrency",
"(",
"$",
"currency",
")",
";",
"if",
"(",
... | Returns the formatted special price for the product by a given currency and locale.
@param string $currency
@param null|string $formatterLocale
@return string | [
"Returns",
"the",
"formatted",
"special",
"price",
"for",
"the",
"product",
"by",
"a",
"given",
"currency",
"and",
"locale",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L792-L800 |
224,088 | sulu/SuluProductBundle | Api/Product.php | Product.getSpecialPriceForCurrency | public function getSpecialPriceForCurrency($currency = 'EUR')
{
$specialPrices = $this->entity->getSpecialPrices();
if ($specialPrices) {
foreach ($specialPrices as $specialPriceEntity) {
if ($specialPriceEntity->getCurrency()->getCode() == $currency) {
... | php | public function getSpecialPriceForCurrency($currency = 'EUR')
{
$specialPrices = $this->entity->getSpecialPrices();
if ($specialPrices) {
foreach ($specialPrices as $specialPriceEntity) {
if ($specialPriceEntity->getCurrency()->getCode() == $currency) {
... | [
"public",
"function",
"getSpecialPriceForCurrency",
"(",
"$",
"currency",
"=",
"'EUR'",
")",
"{",
"$",
"specialPrices",
"=",
"$",
"this",
"->",
"entity",
"->",
"getSpecialPrices",
"(",
")",
";",
"if",
"(",
"$",
"specialPrices",
")",
"{",
"foreach",
"(",
"$... | Returns the special price for a certain currency.
@param string $currency
@return ProductPrice[] | [
"Returns",
"the",
"special",
"price",
"for",
"a",
"certain",
"currency",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L809-L829 |
224,089 | sulu/SuluProductBundle | Api/Product.php | Product.getFormattedBasePriceForCurrency | public function getFormattedBasePriceForCurrency($currency = 'EUR')
{
$price = $this->getBasePriceForCurrency($currency);
if ($price) {
return $this->getFormattedPrice($price->getPrice(), $currency, $this->locale);
}
return '';
} | php | public function getFormattedBasePriceForCurrency($currency = 'EUR')
{
$price = $this->getBasePriceForCurrency($currency);
if ($price) {
return $this->getFormattedPrice($price->getPrice(), $currency, $this->locale);
}
return '';
} | [
"public",
"function",
"getFormattedBasePriceForCurrency",
"(",
"$",
"currency",
"=",
"'EUR'",
")",
"{",
"$",
"price",
"=",
"$",
"this",
"->",
"getBasePriceForCurrency",
"(",
"$",
"currency",
")",
";",
"if",
"(",
"$",
"price",
")",
"{",
"return",
"$",
"this... | Returns the formatted base price for the product by a given currency and locale.
@param string $currency
@return string | [
"Returns",
"the",
"formatted",
"base",
"price",
"for",
"the",
"product",
"by",
"a",
"given",
"currency",
"and",
"locale",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L866-L874 |
224,090 | sulu/SuluProductBundle | Api/Product.php | Product.getBasePriceForCurrency | public function getBasePriceForCurrency($currency = 'EUR')
{
$prices = $this->entity->getPrices();
if ($prices) {
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() == $currency && $price->getMinimumQuantity() == 0) {
return new Product... | php | public function getBasePriceForCurrency($currency = 'EUR')
{
$prices = $this->entity->getPrices();
if ($prices) {
foreach ($prices as $price) {
if ($price->getCurrency()->getCode() == $currency && $price->getMinimumQuantity() == 0) {
return new Product... | [
"public",
"function",
"getBasePriceForCurrency",
"(",
"$",
"currency",
"=",
"'EUR'",
")",
"{",
"$",
"prices",
"=",
"$",
"this",
"->",
"entity",
"->",
"getPrices",
"(",
")",
";",
"if",
"(",
"$",
"prices",
")",
"{",
"foreach",
"(",
"$",
"prices",
"as",
... | Returns the base price for the product by a given currency.
@param string $currency
@return ProductPrice | [
"Returns",
"the",
"base",
"price",
"for",
"the",
"product",
"by",
"a",
"given",
"currency",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L883-L895 |
224,091 | sulu/SuluProductBundle | Api/Product.php | Product.getAttributes | public function getAttributes()
{
$attributeEntities = $this->entity->getProductAttributes();
$attributes = [];
foreach ($attributeEntities as $attributesEntity) {
$attributes[] = new ProductAttribute(
$attributesEntity,
$this->locale,
... | php | public function getAttributes()
{
$attributeEntities = $this->entity->getProductAttributes();
$attributes = [];
foreach ($attributeEntities as $attributesEntity) {
$attributes[] = new ProductAttribute(
$attributesEntity,
$this->locale,
... | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"$",
"attributeEntities",
"=",
"$",
"this",
"->",
"entity",
"->",
"getProductAttributes",
"(",
")",
";",
"$",
"attributes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"attributeEntities",
"as",
"$",
"attr... | Returns the attributes for the product.
@VirtualProperty
@SerializedName("attributes")
@return ProductAttributes[] | [
"Returns",
"the",
"attributes",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L926-L940 |
224,092 | sulu/SuluProductBundle | Api/Product.php | Product.getCategories | public function getCategories()
{
$categoryEntities = $this->entity->getCategories();
$categories = [];
if ($categoryEntities) {
foreach ($categoryEntities as $categoryEntity) {
$categories[] = new Category($categoryEntity, $this->locale);
}
}... | php | public function getCategories()
{
$categoryEntities = $this->entity->getCategories();
$categories = [];
if ($categoryEntities) {
foreach ($categoryEntities as $categoryEntity) {
$categories[] = new Category($categoryEntity, $this->locale);
}
}... | [
"public",
"function",
"getCategories",
"(",
")",
"{",
"$",
"categoryEntities",
"=",
"$",
"this",
"->",
"entity",
"->",
"getCategories",
"(",
")",
";",
"$",
"categories",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"categoryEntities",
")",
"{",
"foreach",
"(",
... | Returns the categories for the product.
@VirtualProperty
@SerializedName("categories")
@return CategoryEntity[] | [
"Returns",
"the",
"categories",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L970-L982 |
224,093 | sulu/SuluProductBundle | Api/Product.php | Product.getMedia | public function getMedia()
{
// if media was set by setMedia() use this->media
if ($this->media) {
return $this->media;
}
$mediaCollection = [];
$media = $this->entity->getMedia();
if (!$media) {
return $mediaCollection;
}
forea... | php | public function getMedia()
{
// if media was set by setMedia() use this->media
if ($this->media) {
return $this->media;
}
$mediaCollection = [];
$media = $this->entity->getMedia();
if (!$media) {
return $mediaCollection;
}
forea... | [
"public",
"function",
"getMedia",
"(",
")",
"{",
"// if media was set by setMedia() use this->media",
"if",
"(",
"$",
"this",
"->",
"media",
")",
"{",
"return",
"$",
"this",
"->",
"media",
";",
"}",
"$",
"mediaCollection",
"=",
"[",
"]",
";",
"$",
"media",
... | Returns the media for the product.
@VirtualProperty
@SerializedName("media")
@Groups({"cart"})
@return Media[] | [
"Returns",
"the",
"media",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L1071-L1087 |
224,094 | sulu/SuluProductBundle | Api/Product.php | Product.getMediaByType | private function getMediaByType($type)
{
$collection = [];
$media = $this->getMedia();
if (!$media) {
return $collection;
}
foreach ($media as $asset) {
if ($asset->isTypeOf($type)) {
$collection[] = $asset;
}
}
... | php | private function getMediaByType($type)
{
$collection = [];
$media = $this->getMedia();
if (!$media) {
return $collection;
}
foreach ($media as $asset) {
if ($asset->isTypeOf($type)) {
$collection[] = $asset;
}
}
... | [
"private",
"function",
"getMediaByType",
"(",
"$",
"type",
")",
"{",
"$",
"collection",
"=",
"[",
"]",
";",
"$",
"media",
"=",
"$",
"this",
"->",
"getMedia",
"(",
")",
";",
"if",
"(",
"!",
"$",
"media",
")",
"{",
"return",
"$",
"collection",
";",
... | Returns a media array by a given type for the product.
@param string
@return array | [
"Returns",
"a",
"media",
"array",
"by",
"a",
"given",
"type",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L1187-L1201 |
224,095 | sulu/SuluProductBundle | Api/Product.php | Product.getSpecialPrices | public function getSpecialPrices()
{
$specialPrices = $this->entity->getSpecialPrices();
$specialPricesList = [];
foreach ($specialPrices as $specialPrice) {
$specialPricesList[] = new SpecialPrice($specialPrice, $this->locale);
}
return $specialPricesList;
... | php | public function getSpecialPrices()
{
$specialPrices = $this->entity->getSpecialPrices();
$specialPricesList = [];
foreach ($specialPrices as $specialPrice) {
$specialPricesList[] = new SpecialPrice($specialPrice, $this->locale);
}
return $specialPricesList;
... | [
"public",
"function",
"getSpecialPrices",
"(",
")",
"{",
"$",
"specialPrices",
"=",
"$",
"this",
"->",
"entity",
"->",
"getSpecialPrices",
"(",
")",
";",
"$",
"specialPricesList",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"specialPrices",
"as",
"$",
"specia... | Returns the special prices for the product.
@VirtualProperty
@SerializedName("specialPrices")
@return \Sulu\Bundle\ProductBundle\Api\SpecialPrice[] | [
"Returns",
"the",
"special",
"prices",
"for",
"the",
"product",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Api/Product.php#L1228-L1238 |
224,096 | kesar/PhpOpenSubtitles | src/kesar/PhpOpenSubtitles/FileGenerator.php | FileGenerator.downloadSubtitle | public function downloadSubtitle($url, $originalFile)
{
$subtitleFile = preg_replace("/\\.[^.\\s]{3,4}$/", "", $originalFile) . '.srt';
$subtitleContent = gzdecode(file_get_contents($url));
file_put_contents($subtitleFile, $subtitleContent);
} | php | public function downloadSubtitle($url, $originalFile)
{
$subtitleFile = preg_replace("/\\.[^.\\s]{3,4}$/", "", $originalFile) . '.srt';
$subtitleContent = gzdecode(file_get_contents($url));
file_put_contents($subtitleFile, $subtitleContent);
} | [
"public",
"function",
"downloadSubtitle",
"(",
"$",
"url",
",",
"$",
"originalFile",
")",
"{",
"$",
"subtitleFile",
"=",
"preg_replace",
"(",
"\"/\\\\.[^.\\\\s]{3,4}$/\"",
",",
"\"\"",
",",
"$",
"originalFile",
")",
".",
"'.srt'",
";",
"$",
"subtitleContent",
... | Download subtitle and put it in the same folder than the video with the same name + srt
@param string $url
@param string $originalFile | [
"Download",
"subtitle",
"and",
"put",
"it",
"in",
"the",
"same",
"folder",
"than",
"the",
"video",
"with",
"the",
"same",
"name",
"+",
"srt"
] | 8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3 | https://github.com/kesar/PhpOpenSubtitles/blob/8b2ed1a06f393aa33403b27b32cace3c3c7d4ef3/src/kesar/PhpOpenSubtitles/FileGenerator.php#L13-L19 |
224,097 | actualreports/pdfgeneratorapi-laravel | src/Repositories/DataRepository.php | DataRepository.getUrl | public function getUrl()
{
$data = $this->getRawData();
/**
* If data is already an url don't save new file
*/
if ($data && !filter_var($data, FILTER_VALIDATE_URL) !== false)
{
if(!is_string($data))
{
$data = \GuzzleHttp\json_... | php | public function getUrl()
{
$data = $this->getRawData();
/**
* If data is already an url don't save new file
*/
if ($data && !filter_var($data, FILTER_VALIDATE_URL) !== false)
{
if(!is_string($data))
{
$data = \GuzzleHttp\json_... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getRawData",
"(",
")",
";",
"/**\n * If data is already an url don't save new file\n */",
"if",
"(",
"$",
"data",
"&&",
"!",
"filter_var",
"(",
"$",
"data",
",",... | Saves a temporary json file and generates public url that is sent to PDF Generator service
@return string | [
"Saves",
"a",
"temporary",
"json",
"file",
"and",
"generates",
"public",
"url",
"that",
"is",
"sent",
"to",
"PDF",
"Generator",
"service"
] | f5fb75cb7c5f15029844378f9c9c098f7126178a | https://github.com/actualreports/pdfgeneratorapi-laravel/blob/f5fb75cb7c5f15029844378f9c9c098f7126178a/src/Repositories/DataRepository.php#L29-L49 |
224,098 | sulu/SuluProductBundle | Product/DeliveryStatusManager.php | DeliveryStatusManager.findAll | public function findAll($locale)
{
$statuses = $this->deliveryStatusRepository->findAllByLocale($locale);
array_walk(
$statuses,
function (&$status) use ($locale) {
$status = new DeliveryStatus($status, $locale);
}
);
return $stat... | php | public function findAll($locale)
{
$statuses = $this->deliveryStatusRepository->findAllByLocale($locale);
array_walk(
$statuses,
function (&$status) use ($locale) {
$status = new DeliveryStatus($status, $locale);
}
);
return $stat... | [
"public",
"function",
"findAll",
"(",
"$",
"locale",
")",
"{",
"$",
"statuses",
"=",
"$",
"this",
"->",
"deliveryStatusRepository",
"->",
"findAllByLocale",
"(",
"$",
"locale",
")",
";",
"array_walk",
"(",
"$",
"statuses",
",",
"function",
"(",
"&",
"$",
... | Returns all delivery statuses by given locale.
@param string $locale
@return null|DeliveryStatus[] | [
"Returns",
"all",
"delivery",
"statuses",
"by",
"given",
"locale",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/DeliveryStatusManager.php#L46-L58 |
224,099 | sulu/SuluProductBundle | Product/DeliveryStatusManager.php | DeliveryStatusManager.retrieveTranslationByIdAndLocale | public function retrieveTranslationByIdAndLocale($deliveryStatusId, $locale)
{
/** @var DeliveryStatusEntity $deliveryStatus */
$deliveryStatus = $this->deliveryStatusRepository->find($deliveryStatusId);
if (!$deliveryStatus || $deliveryStatus->getTranslations()->count() < 1) {
... | php | public function retrieveTranslationByIdAndLocale($deliveryStatusId, $locale)
{
/** @var DeliveryStatusEntity $deliveryStatus */
$deliveryStatus = $this->deliveryStatusRepository->find($deliveryStatusId);
if (!$deliveryStatus || $deliveryStatus->getTranslations()->count() < 1) {
... | [
"public",
"function",
"retrieveTranslationByIdAndLocale",
"(",
"$",
"deliveryStatusId",
",",
"$",
"locale",
")",
"{",
"/** @var DeliveryStatusEntity $deliveryStatus */",
"$",
"deliveryStatus",
"=",
"$",
"this",
"->",
"deliveryStatusRepository",
"->",
"find",
"(",
"$",
"... | Returns DeliveryStatusTranslation by given DeliveryStatus-id and locale.
@param int $deliveryStatusId
@param string $locale
@return null|DeliveryStatusTranslation | [
"Returns",
"DeliveryStatusTranslation",
"by",
"given",
"DeliveryStatus",
"-",
"id",
"and",
"locale",
"."
] | 9f22c2dab940a04463c98e415b15ea1d62828316 | https://github.com/sulu/SuluProductBundle/blob/9f22c2dab940a04463c98e415b15ea1d62828316/Product/DeliveryStatusManager.php#L68-L88 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.