repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
nafiesl/SimpleCrudGenerator | src/Generators/RouteGenerator.php | RouteGenerator.generate | public function generate(string $type = 'web')
{
$webRoutePath = $this->makeRouteFile(base_path('routes'), $type.'.php');
$this->files->append($webRoutePath, $this->getContent('routes/'.$type));
$this->command->info($this->modelNames['model_name'].' resource route generated on routes/'.$ty... | php | public function generate(string $type = 'web')
{
$webRoutePath = $this->makeRouteFile(base_path('routes'), $type.'.php');
$this->files->append($webRoutePath, $this->getContent('routes/'.$type));
$this->command->info($this->modelNames['model_name'].' resource route generated on routes/'.$ty... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'web'",
")",
"{",
"$",
"webRoutePath",
"=",
"$",
"this",
"->",
"makeRouteFile",
"(",
"base_path",
"(",
"'routes'",
")",
",",
"$",
"type",
".",
"'.php'",
")",
";",
"$",
"this",
"->",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/RouteGenerator.php#L13-L20 |
nafiesl/SimpleCrudGenerator | src/Generators/RouteGenerator.php | RouteGenerator.getContent | public function getContent(string $stubName)
{
$stub = $this->getStubFileContent($stubName);
$webRouteFileContent = $this->replaceStubString($stub);
if (!is_null($parentName = $this->command->option('parent'))) {
$modelName = $this->modelNames['model_name'];
$webRo... | php | public function getContent(string $stubName)
{
$stub = $this->getStubFileContent($stubName);
$webRouteFileContent = $this->replaceStubString($stub);
if (!is_null($parentName = $this->command->option('parent'))) {
$modelName = $this->modelNames['model_name'];
$webRo... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"stubName",
")",
"{",
"$",
"stub",
"=",
"$",
"this",
"->",
"getStubFileContent",
"(",
"$",
"stubName",
")",
";",
"$",
"webRouteFileContent",
"=",
"$",
"this",
"->",
"replaceStubString",
"(",
"$",
"stu... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/RouteGenerator.php#L25-L42 |
nafiesl/SimpleCrudGenerator | src/Generators/RouteGenerator.php | RouteGenerator.makeRouteFile | protected function makeRouteFile($routeDirPath, $filename)
{
if (!$this->files->isDirectory($routeDirPath)) {
$this->files->makeDirectory($routeDirPath, 0777, true, true);
}
if (!$this->files->exists($routeDirPath.'/'.$filename)) {
$this->generateFile($routeDirPath.'... | php | protected function makeRouteFile($routeDirPath, $filename)
{
if (!$this->files->isDirectory($routeDirPath)) {
$this->files->makeDirectory($routeDirPath, 0777, true, true);
}
if (!$this->files->exists($routeDirPath.'/'.$filename)) {
$this->generateFile($routeDirPath.'... | [
"protected",
"function",
"makeRouteFile",
"(",
"$",
"routeDirPath",
",",
"$",
"filename",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"isDirectory",
"(",
"$",
"routeDirPath",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"makeDirectory... | Create php route file if not exists
@param string $routeDirPath Absolute directory path
@param string $filename File name to be created
@return string Absolute path of create route file | [
"Create",
"php",
"route",
"file",
"if",
"not",
"exists"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/RouteGenerator.php#L52-L63 |
nafiesl/SimpleCrudGenerator | src/Generators/FormRequestGenerator.php | FormRequestGenerator.generate | public function generate(string $type = 'full')
{
$modelName = $this->modelNames['model_name'];
$pluralModelName = $this->modelNames['plural_model_name'];
$requestPath = $this->makeDirectory(app_path('Http/Requests/'.$pluralModelName));
$this->generateFile(
$requestPath... | php | public function generate(string $type = 'full')
{
$modelName = $this->modelNames['model_name'];
$pluralModelName = $this->modelNames['plural_model_name'];
$requestPath = $this->makeDirectory(app_path('Http/Requests/'.$pluralModelName));
$this->generateFile(
$requestPath... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"modelName",
"=",
"$",
"this",
"->",
"modelNames",
"[",
"'model_name'",
"]",
";",
"$",
"pluralModelName",
"=",
"$",
"this",
"->",
"modelNames",
"[",
"'plural_model_... | Generate class file content.
@param string $type Type of crud
@return void | [
"Generate",
"class",
"file",
"content",
"."
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/FormRequestGenerator.php#L16-L31 |
nafiesl/SimpleCrudGenerator | src/Generators/FormRequestGenerator.php | FormRequestGenerator.getContent | public function getContent(string $stubName)
{
$stub = $this->getStubFileContent($stubName);
$requestFileContent = $this->replaceStubString($stub);
$appNamespace = $this->getAppNamespace();
$requestFileContent = str_replace(
"App\Http\Requests",
"{$appNames... | php | public function getContent(string $stubName)
{
$stub = $this->getStubFileContent($stubName);
$requestFileContent = $this->replaceStubString($stub);
$appNamespace = $this->getAppNamespace();
$requestFileContent = str_replace(
"App\Http\Requests",
"{$appNames... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"stubName",
")",
"{",
"$",
"stub",
"=",
"$",
"this",
"->",
"getStubFileContent",
"(",
"$",
"stubName",
")",
";",
"$",
"requestFileContent",
"=",
"$",
"this",
"->",
"replaceStubString",
"(",
"$",
"stub... | Get class file content.
@param string $stubName Name of stub file
@return string | [
"Get",
"class",
"file",
"content",
"."
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/FormRequestGenerator.php#L39-L54 |
nafiesl/SimpleCrudGenerator | src/Generators/ModelGenerator.php | ModelGenerator.generate | public function generate(string $type = 'full')
{
$modelPath = $this->modelNames['model_path'];
$modelDirectory = $this->makeDirectory(app_path($modelPath));
$this->generateFile(
$modelDirectory.'/'.$this->modelNames['model_name'].'.php',
$this->getContent('models/mo... | php | public function generate(string $type = 'full')
{
$modelPath = $this->modelNames['model_path'];
$modelDirectory = $this->makeDirectory(app_path($modelPath));
$this->generateFile(
$modelDirectory.'/'.$this->modelNames['model_name'].'.php',
$this->getContent('models/mo... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"modelPath",
"=",
"$",
"this",
"->",
"modelNames",
"[",
"'model_path'",
"]",
";",
"$",
"modelDirectory",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"app_path",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelGenerator.php#L13-L24 |
nafiesl/SimpleCrudGenerator | src/Generators/ModelGenerator.php | ModelGenerator.getContent | public function getContent(string $stubName)
{
if ($this->command->option('formfield')) {
$stubName .= '-formfield';
}
$modelFileContent = $this->getStubFileContent($stubName);
$userModel = config('auth.providers.users.model');
if ('App\User' !== $userModel) {
... | php | public function getContent(string $stubName)
{
if ($this->command->option('formfield')) {
$stubName .= '-formfield';
}
$modelFileContent = $this->getStubFileContent($stubName);
$userModel = config('auth.providers.users.model');
if ('App\User' !== $userModel) {
... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"stubName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"command",
"->",
"option",
"(",
"'formfield'",
")",
")",
"{",
"$",
"stubName",
".=",
"'-formfield'",
";",
"}",
"$",
"modelFileContent",
"=",
"$",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelGenerator.php#L29-L44 |
nafiesl/SimpleCrudGenerator | src/Generators/IndexViewGenerator.php | IndexViewGenerator.generate | public function generate(string $type = 'full')
{
$viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name']));
$this->generateFile($viewPath.'/index.blade.php', $this->getContent('resources/views/'.$type.'/index'));
$this->command->info($this->modelNames['mode... | php | public function generate(string $type = 'full')
{
$viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name']));
$this->generateFile($viewPath.'/index.blade.php', $this->getContent('resources/views/'.$type.'/index'));
$this->command->info($this->modelNames['mode... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"viewPath",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"resource_path",
"(",
"'views/'",
".",
"$",
"this",
"->",
"modelNames",
"[",
"'table_name'",
"]",
")",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/IndexViewGenerator.php#L13-L20 |
nafiesl/SimpleCrudGenerator | src/Generators/IndexViewGenerator.php | IndexViewGenerator.getContent | public function getContent(string $stubName)
{
if ($this->command->option('formfield')) {
$stubName .= '-formfield';
}
if ($this->command->option('bs3')) {
$stubName .= '-bs3';
}
return $this->replaceStubString($this->getStubFileContent($stubName));
... | php | public function getContent(string $stubName)
{
if ($this->command->option('formfield')) {
$stubName .= '-formfield';
}
if ($this->command->option('bs3')) {
$stubName .= '-bs3';
}
return $this->replaceStubString($this->getStubFileContent($stubName));
... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"stubName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"command",
"->",
"option",
"(",
"'formfield'",
")",
")",
"{",
"$",
"stubName",
".=",
"'-formfield'",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/IndexViewGenerator.php#L25-L36 |
nafiesl/SimpleCrudGenerator | src/Generators/LangFileGenerator.php | LangFileGenerator.generate | public function generate(string $type = 'full')
{
$locale = config('app.locale');
$langPath = $this->makeDirectory(resource_path('lang/'.$locale));
$this->createAppLangFile($langPath);
$this->generateFile($langPath.'/'.$this->modelNames['lang_name'].'.php', $this->getContent($local... | php | public function generate(string $type = 'full')
{
$locale = config('app.locale');
$langPath = $this->makeDirectory(resource_path('lang/'.$locale));
$this->createAppLangFile($langPath);
$this->generateFile($langPath.'/'.$this->modelNames['lang_name'].'.php', $this->getContent($local... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"locale",
"=",
"config",
"(",
"'app.locale'",
")",
";",
"$",
"langPath",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"resource_path",
"(",
"'lang/'",
".",
"$",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/LangFileGenerator.php#L13-L23 |
nafiesl/SimpleCrudGenerator | src/Generators/LangFileGenerator.php | LangFileGenerator.getContent | public function getContent(string $locale)
{
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/master.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->files->get(__DIR__.'/../stubs/resourc... | php | public function getContent(string $locale)
{
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/master.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->files->get(__DIR__.'/../stubs/resourc... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"locale",
")",
"{",
"$",
"langStubPath",
"=",
"__DIR__",
".",
"'/../stubs/resources/lang/'",
".",
"$",
"locale",
".",
"'/master.stub'",
";",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/LangFileGenerator.php#L28-L47 |
nafiesl/SimpleCrudGenerator | src/Generators/LangFileGenerator.php | LangFileGenerator.createAppLangFile | private function createAppLangFile($langPath)
{
if (!$this->files->exists($langPath.'/app.php')) {
$this->generateFile($langPath.'/app.php', $this->getAppLangFileContent());
$this->command->info('lang/app.php generated.');
}
} | php | private function createAppLangFile($langPath)
{
if (!$this->files->exists($langPath.'/app.php')) {
$this->generateFile($langPath.'/app.php', $this->getAppLangFileContent());
$this->command->info('lang/app.php generated.');
}
} | [
"private",
"function",
"createAppLangFile",
"(",
"$",
"langPath",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"langPath",
".",
"'/app.php'",
")",
")",
"{",
"$",
"this",
"->",
"generateFile",
"(",
"$",
"langPath",
"."... | Generate lang/app.php file if it doesn't exists
@param string $langPath Directory path of lang files
@return void | [
"Generate",
"lang",
"/",
"app",
".",
"php",
"file",
"if",
"it",
"doesn",
"t",
"exists"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/LangFileGenerator.php#L55-L61 |
nafiesl/SimpleCrudGenerator | src/Generators/LangFileGenerator.php | LangFileGenerator.getAppLangFileContent | private function getAppLangFileContent()
{
$locale = config('app.locale');
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/app.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->f... | php | private function getAppLangFileContent()
{
$locale = config('app.locale');
$langStubPath = __DIR__.'/../stubs/resources/lang/'.$locale.'/app.stub';
if ($this->files->exists($langStubPath)) {
$stub = $this->files->get($langStubPath);
} else {
$stub = $this->f... | [
"private",
"function",
"getAppLangFileContent",
"(",
")",
"{",
"$",
"locale",
"=",
"config",
"(",
"'app.locale'",
")",
";",
"$",
"langStubPath",
"=",
"__DIR__",
".",
"'/../stubs/resources/lang/'",
".",
"$",
"locale",
".",
"'/app.stub'",
";",
"if",
"(",
"$",
... | Get lang/app.php file content
@return string | [
"Get",
"lang",
"/",
"app",
".",
"php",
"file",
"content"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/LangFileGenerator.php#L68-L80 |
nafiesl/SimpleCrudGenerator | src/Generators/FormViewGenerator.php | FormViewGenerator.generate | public function generate(string $type = 'full')
{
$viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name']));
if ($type == 'simple') {
$this->generateFile($viewPath.'/forms.blade.php', $this->getContent('resources/views/simple/forms'));
} else {
... | php | public function generate(string $type = 'full')
{
$viewPath = $this->makeDirectory(resource_path('views/'.$this->modelNames['table_name']));
if ($type == 'simple') {
$this->generateFile($viewPath.'/forms.blade.php', $this->getContent('resources/views/simple/forms'));
} else {
... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"viewPath",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"resource_path",
"(",
"'views/'",
".",
"$",
"this",
"->",
"modelNames",
"[",
"'table_name'",
"]",
")",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/FormViewGenerator.php#L13-L25 |
nafiesl/SimpleCrudGenerator | src/Generators/ModelFactoryGenerator.php | ModelFactoryGenerator.generate | public function generate(string $type = 'full')
{
$modelFactoryPath = $this->makeDirectory(database_path('factories'));
$this->generateFile(
$modelFactoryPath.'/'.$this->modelNames['model_name'].'Factory.php',
$this->getContent('database/factories/model-factory')
);
... | php | public function generate(string $type = 'full')
{
$modelFactoryPath = $this->makeDirectory(database_path('factories'));
$this->generateFile(
$modelFactoryPath.'/'.$this->modelNames['model_name'].'Factory.php',
$this->getContent('database/factories/model-factory')
);
... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"modelFactoryPath",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"database_path",
"(",
"'factories'",
")",
")",
";",
"$",
"this",
"->",
"generateFile",
"(",
"$",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelFactoryGenerator.php#L13-L23 |
nafiesl/SimpleCrudGenerator | src/Generators/ModelFactoryGenerator.php | ModelFactoryGenerator.getContent | public function getContent(string $stubName)
{
$modelFactoryFileContent = $this->getStubFileContent($stubName);
$userModel = config('auth.providers.users.model');
if ('App\User' !== $userModel) {
$modelFactoryFileContent = str_replace('App\User', $userModel, $modelFactoryFileCo... | php | public function getContent(string $stubName)
{
$modelFactoryFileContent = $this->getStubFileContent($stubName);
$userModel = config('auth.providers.users.model');
if ('App\User' !== $userModel) {
$modelFactoryFileContent = str_replace('App\User', $userModel, $modelFactoryFileCo... | [
"public",
"function",
"getContent",
"(",
"string",
"$",
"stubName",
")",
"{",
"$",
"modelFactoryFileContent",
"=",
"$",
"this",
"->",
"getStubFileContent",
"(",
"$",
"stubName",
")",
";",
"$",
"userModel",
"=",
"config",
"(",
"'auth.providers.users.model'",
")",... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/ModelFactoryGenerator.php#L28-L39 |
nafiesl/SimpleCrudGenerator | src/Generators/MigrationGenerator.php | MigrationGenerator.generate | public function generate(string $type = 'full')
{
$prefix = date('Y_m_d_His');
$tableName = $this->modelNames['table_name'];
$migrationPath = $this->makeDirectory(database_path('migrations'));
$migrationFilePath = $migrationPath.'/'.$prefix."_create_{$tableName}_table.php";
... | php | public function generate(string $type = 'full')
{
$prefix = date('Y_m_d_His');
$tableName = $this->modelNames['table_name'];
$migrationPath = $this->makeDirectory(database_path('migrations'));
$migrationFilePath = $migrationPath.'/'.$prefix."_create_{$tableName}_table.php";
... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"type",
"=",
"'full'",
")",
"{",
"$",
"prefix",
"=",
"date",
"(",
"'Y_m_d_His'",
")",
";",
"$",
"tableName",
"=",
"$",
"this",
"->",
"modelNames",
"[",
"'table_name'",
"]",
";",
"$",
"migrationPath",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/nafiesl/SimpleCrudGenerator/blob/9dad414174c4f45e76130cc54661f3c5996c4b71/src/Generators/MigrationGenerator.php#L13-L24 |
maxmind/MaxMind-DB-Reader-php | src/MaxMind/Db/Reader.php | Reader.get | public function get($ipAddress)
{
if (\func_num_args() !== 1) {
throw new \InvalidArgumentException(
'Method takes exactly one argument.'
);
}
if (!\is_resource($this->fileHandle)) {
throw new \BadMethodCallException(
'Atte... | php | public function get($ipAddress)
{
if (\func_num_args() !== 1) {
throw new \InvalidArgumentException(
'Method takes exactly one argument.'
);
}
if (!\is_resource($this->fileHandle)) {
throw new \BadMethodCallException(
'Atte... | [
"public",
"function",
"get",
"(",
"$",
"ipAddress",
")",
"{",
"if",
"(",
"\\",
"func_num_args",
"(",
")",
"!==",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Method takes exactly one argument.'",
")",
";",
"}",
"if",
"(",
"!",
"\... | Looks up the address in the MaxMind DB.
@param string $ipAddress
the IP address to look up
@throws \BadMethodCallException if this method is called on a closed database
@throws \InvalidArgumentException if something other than a single IP address is passed to the method
@throws InvalidDatabaseException
if the datab... | [
"Looks",
"up",
"the",
"address",
"in",
"the",
"MaxMind",
"DB",
"."
] | train | https://github.com/maxmind/MaxMind-DB-Reader-php/blob/158b1e4a5759c650b6faa733a8063e06160bc948/src/MaxMind/Db/Reader.php#L89-L121 |
maxmind/MaxMind-DB-Reader-php | src/MaxMind/Db/Reader.php | Reader.findMetadataStart | private function findMetadataStart($filename)
{
$handle = $this->fileHandle;
$fstat = fstat($handle);
$fileSize = $fstat['size'];
$marker = self::$METADATA_START_MARKER;
$markerLength = self::$METADATA_START_MARKER_LENGTH;
$metadataMaxLengthExcludingMarker
... | php | private function findMetadataStart($filename)
{
$handle = $this->fileHandle;
$fstat = fstat($handle);
$fileSize = $fstat['size'];
$marker = self::$METADATA_START_MARKER;
$markerLength = self::$METADATA_START_MARKER_LENGTH;
$metadataMaxLengthExcludingMarker
... | [
"private",
"function",
"findMetadataStart",
"(",
"$",
"filename",
")",
"{",
"$",
"handle",
"=",
"$",
"this",
"->",
"fileHandle",
";",
"$",
"fstat",
"=",
"fstat",
"(",
"$",
"handle",
")",
";",
"$",
"fileSize",
"=",
"$",
"fstat",
"[",
"'size'",
"]",
";... | /*
This is an extremely naive but reasonably readable implementation. There
are much faster algorithms (e.g., Boyer-Moore) for this if speed is ever
an issue, but I suspect it won't be. | [
"/",
"*",
"This",
"is",
"an",
"extremely",
"naive",
"but",
"reasonably",
"readable",
"implementation",
".",
"There",
"are",
"much",
"faster",
"algorithms",
"(",
"e",
".",
"g",
".",
"Boyer",
"-",
"Moore",
")",
"for",
"this",
"if",
"speed",
"is",
"ever",
... | train | https://github.com/maxmind/MaxMind-DB-Reader-php/blob/158b1e4a5759c650b6faa733a8063e06160bc948/src/MaxMind/Db/Reader.php#L242-L267 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.curl | public function curl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch, CURLOPT_... | php | public function curl($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch, CURLOPT_... | [
"public",
"function",
"curl",
"(",
"$",
"url",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_USERAGENT",
",",
"'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0'",
")",
";",
... | what identifies each request? user agent, cookies... | [
"what",
"identifies",
"each",
"request?",
"user",
"agent",
"cookies",
"..."
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L68-L87 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.head | public static function head($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_NOBODY, 1);
$result = curl_exec($ch);
curl_close... | php | public static function head($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_NOBODY, 1);
$result = curl_exec($ch);
curl_close... | [
"public",
"static",
"function",
"head",
"(",
"$",
"url",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HEADER",
",",
"1",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTR... | TODO: remove this as it required PECL extension | [
"TODO",
":",
"remove",
"this",
"as",
"it",
"required",
"PECL",
"extension"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L90-L102 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.getPlayerUrl | public function getPlayerUrl($video_html)
{
if (strpos($video_html, 'http') === 0) {
$video_html = $this->curl($video_html);
}
$player_url = null;
// check what player version that video is using
if (preg_match('@<script\s*src="([^"]+player[^"]+js)@', $video_htm... | php | public function getPlayerUrl($video_html)
{
if (strpos($video_html, 'http') === 0) {
$video_html = $this->curl($video_html);
}
$player_url = null;
// check what player version that video is using
if (preg_match('@<script\s*src="([^"]+player[^"]+js)@', $video_htm... | [
"public",
"function",
"getPlayerUrl",
"(",
"$",
"video_html",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"video_html",
",",
"'http'",
")",
"===",
"0",
")",
"{",
"$",
"video_html",
"=",
"$",
"this",
"->",
"curl",
"(",
"$",
"video_html",
")",
";",
"}",
... | <script src="//s.ytimg.com/yts/jsbin/player-fr_FR-vflHVjlC5/base.js" name="player/base"></script> | [
"<script",
"src",
"=",
"//",
"s",
".",
"ytimg",
".",
"com",
"/",
"yts",
"/",
"jsbin",
"/",
"player",
"-",
"fr_FR",
"-",
"vflHVjlC5",
"/",
"base",
".",
"js",
"name",
"=",
"player",
"/",
"base",
">",
"<",
"/",
"script",
">"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L106-L128 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.getPlayerHtml | public function getPlayerHtml($video_html)
{
$player_url = $this->getPlayerUrl($video_html);
$cache_path = sprintf('%s/%s', $this->storage_dir, md5($player_url));
if (file_exists($cache_path)) {
$contents = file_get_contents($cache_path);
//return unserialize($conte... | php | public function getPlayerHtml($video_html)
{
$player_url = $this->getPlayerUrl($video_html);
$cache_path = sprintf('%s/%s', $this->storage_dir, md5($player_url));
if (file_exists($cache_path)) {
$contents = file_get_contents($cache_path);
//return unserialize($conte... | [
"public",
"function",
"getPlayerHtml",
"(",
"$",
"video_html",
")",
"{",
"$",
"player_url",
"=",
"$",
"this",
"->",
"getPlayerUrl",
"(",
"$",
"video_html",
")",
";",
"$",
"cache_path",
"=",
"sprintf",
"(",
"'%s/%s'",
",",
"$",
"this",
"->",
"storage_dir",
... | Do not redownload player.js everytime - cache it | [
"Do",
"not",
"redownload",
"player",
".",
"js",
"everytime",
"-",
"cache",
"it"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L131-L148 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.getSigDecodeFunctionName | public function getSigDecodeFunctionName($player_html)
{
$pattern = '@yt\.akamaized\.net\/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*\([^\)]+\)\(([a-zA-Z0-9$]+)@is';
if (preg_match($pattern, $player_html, $matches)) {
$func_name = $matches[1];
$func_name = preg_quote($fu... | php | public function getSigDecodeFunctionName($player_html)
{
$pattern = '@yt\.akamaized\.net\/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*\([^\)]+\)\(([a-zA-Z0-9$]+)@is';
if (preg_match($pattern, $player_html, $matches)) {
$func_name = $matches[1];
$func_name = preg_quote($fu... | [
"public",
"function",
"getSigDecodeFunctionName",
"(",
"$",
"player_html",
")",
"{",
"$",
"pattern",
"=",
"'@yt\\.akamaized\\.net\\/\\)\\s*\\|\\|\\s*.*?\\s*c\\s*&&\\s*d\\.set\\([^,]+\\s*,\\s*\\([^\\)]+\\)\\(([a-zA-Z0-9$]+)@is'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
... | /*
Youtube Sep2018 Changes
deDE:
var aL={NI:function(a,b){a.splice(0,b)},jl:function(a){a.reverse()},l5:function(a,b){var c=a[0];a[0]=a[b%a.length];a[b%a.length]=c}}
bL=function(a){a=a.split("");aL.jl(a,58);aL.NI(a,2);aL.l5(a,35);aL.NI(a,2);aL.jl(a,45);aL.l5(a,4);aL.jl(a,46);return a.join("")};
->$L=function(a,b,c){b=v... | [
"/",
"*",
"Youtube",
"Sep2018",
"Changes",
"deDE",
":",
"var",
"aL",
"=",
"{",
"NI",
":",
"function",
"(",
"a",
"b",
")",
"{",
"a",
".",
"splice",
"(",
"0",
"b",
")",
"}",
"jl",
":",
"function",
"(",
"a",
")",
"{",
"a",
".",
"reverse",
"()",
... | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L157-L169 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.getSigDecodeInstructions | public function getSigDecodeInstructions($player_html, $func_name)
{
// extract code block from that function
// single quote in case function name contains $dollar sign
// xm=function(a){a=a.split("");wm.zO(a,47);wm.vY(a,1);wm.z9(a,68);wm.zO(a,21);wm.z9(a,34);wm.zO(a,16);wm.z9(a,41);return ... | php | public function getSigDecodeInstructions($player_html, $func_name)
{
// extract code block from that function
// single quote in case function name contains $dollar sign
// xm=function(a){a=a.split("");wm.zO(a,47);wm.vY(a,1);wm.z9(a,68);wm.zO(a,21);wm.z9(a,34);wm.zO(a,16);wm.z9(a,41);return ... | [
"public",
"function",
"getSigDecodeInstructions",
"(",
"$",
"player_html",
",",
"$",
"func_name",
")",
"{",
"// extract code block from that function",
"// single quote in case function name contains $dollar sign",
"// xm=function(a){a=a.split(\"\");wm.zO(a,47);wm.vY(a,1);wm.z9(a,68);wm.zO... | convert JS code for signature decipher to PHP code | [
"convert",
"JS",
"code",
"for",
"signature",
"decipher",
"to",
"PHP",
"code"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L172-L220 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.stream | public function stream($id)
{
$links = $this->getDownloadLinks($id, "mp4");
if (count($links) == 0) {
die("no url found!");
}
// grab first available MP4 link
$url = $links[0]['url'];
// request headers
$headers = array(
'User-Agent:... | php | public function stream($id)
{
$links = $this->getDownloadLinks($id, "mp4");
if (count($links) == 0) {
die("no url found!");
}
// grab first available MP4 link
$url = $links[0]['url'];
// request headers
$headers = array(
'User-Agent:... | [
"public",
"function",
"stream",
"(",
"$",
"id",
")",
"{",
"$",
"links",
"=",
"$",
"this",
"->",
"getDownloadLinks",
"(",
"$",
"id",
",",
"\"mp4\"",
")",
";",
"if",
"(",
"count",
"(",
"$",
"links",
")",
"==",
"0",
")",
"{",
"die",
"(",
"\"no url f... | TODO: move this to its own HttpClient class | [
"TODO",
":",
"move",
"this",
"to",
"its",
"own",
"HttpClient",
"class"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L254-L334 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.selectFirst | private function selectFirst($links, $selector)
{
$result = array();
$formats = preg_split('/\s*,\s*/', $selector);
// has to be in this order
foreach ($formats as $f) {
foreach ($links as $l) {
if (stripos($l['format'], $f) !== false || $f == 'any') {
... | php | private function selectFirst($links, $selector)
{
$result = array();
$formats = preg_split('/\s*,\s*/', $selector);
// has to be in this order
foreach ($formats as $f) {
foreach ($links as $l) {
if (stripos($l['format'], $f) !== false || $f == 'any') {
... | [
"private",
"function",
"selectFirst",
"(",
"$",
"links",
",",
"$",
"selector",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"formats",
"=",
"preg_split",
"(",
"'/\\s*,\\s*/'",
",",
"$",
"selector",
")",
";",
"// has to be in this order",
"for... | selector by format: mp4 360, | [
"selector",
"by",
"format",
":",
"mp4",
"360"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L347-L364 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.parseStreamMap | public function parseStreamMap($video_html, $video_id)
{
$stream_map = array();
$result = array();
// http://stackoverflow.com/questions/35608686/how-can-i-get-the-actual-video-url-of-a-youtube-live-stream
if (preg_match('@url_encoded_fmt_stream_map["\']:\s*["\']([^"\'\s]*)@', $vide... | php | public function parseStreamMap($video_html, $video_id)
{
$stream_map = array();
$result = array();
// http://stackoverflow.com/questions/35608686/how-can-i-get-the-actual-video-url-of-a-youtube-live-stream
if (preg_match('@url_encoded_fmt_stream_map["\']:\s*["\']([^"\'\s]*)@', $vide... | [
"public",
"function",
"parseStreamMap",
"(",
"$",
"video_html",
",",
"$",
"video_id",
")",
"{",
"$",
"stream_map",
"=",
"array",
"(",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// http://stackoverflow.com/questions/35608686/how-can-i-get-the-actual-video... | some of the data may need signature decoding | [
"some",
"of",
"the",
"data",
"may",
"need",
"signature",
"decoding"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L367-L401 |
Athlon1600/youtube-downloader | src/YouTubeDownloader.php | YouTubeDownloader.getDownloadLinks | public function getDownloadLinks($video_id, $selector = false)
{
// you can input HTML of /watch? page directory instead of id
$video_id = $this->extractVideoId($video_id);
$video_html = $this->curl("https://www.youtube.com/watch?v={$video_id}");
$result = array();
$url_map... | php | public function getDownloadLinks($video_id, $selector = false)
{
// you can input HTML of /watch? page directory instead of id
$video_id = $this->extractVideoId($video_id);
$video_html = $this->curl("https://www.youtube.com/watch?v={$video_id}");
$result = array();
$url_map... | [
"public",
"function",
"getDownloadLinks",
"(",
"$",
"video_id",
",",
"$",
"selector",
"=",
"false",
")",
"{",
"// you can input HTML of /watch? page directory instead of id",
"$",
"video_id",
"=",
"$",
"this",
"->",
"extractVideoId",
"(",
"$",
"video_id",
")",
";",
... | TODO: make it accept video_html too | [
"TODO",
":",
"make",
"it",
"accept",
"video_html",
"too"
] | train | https://github.com/Athlon1600/youtube-downloader/blob/cf7f86346552f4834f96e6ec80677dae1d7bbc5a/src/YouTubeDownloader.php#L405-L448 |
docker-php/docker-php | src/Stream/CallbackStream.php | CallbackStream.wait | public function wait(): void
{
while (!$this->stream->eof()) {
$frame = $this->readFrame();
if (null !== $frame) {
if (!\is_array($frame)) {
$frame = [$frame];
}
foreach ($this->onNewFrameCallables as $newFrameCall... | php | public function wait(): void
{
while (!$this->stream->eof()) {
$frame = $this->readFrame();
if (null !== $frame) {
if (!\is_array($frame)) {
$frame = [$frame];
}
foreach ($this->onNewFrameCallables as $newFrameCall... | [
"public",
"function",
"wait",
"(",
")",
":",
"void",
"{",
"while",
"(",
"!",
"$",
"this",
"->",
"stream",
"->",
"eof",
"(",
")",
")",
"{",
"$",
"frame",
"=",
"$",
"this",
"->",
"readFrame",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"frame",... | Wait for stream to finish and call callables if defined. | [
"Wait",
"for",
"stream",
"to",
"finish",
"and",
"call",
"callables",
"if",
"defined",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/CallbackStream.php#L40-L55 |
docker-php/docker-php | src/DockerAsync.php | DockerAsync.systemEvents | public function systemEvents(array $queryParameters = [], string $fetch = self::FETCH_OBJECT): Promise
{
return $this->executeArtaxEndpoint(new SystemEvents($queryParameters), $fetch);
} | php | public function systemEvents(array $queryParameters = [], string $fetch = self::FETCH_OBJECT): Promise
{
return $this->executeArtaxEndpoint(new SystemEvents($queryParameters), $fetch);
} | [
"public",
"function",
"systemEvents",
"(",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
":",
"Promise",
"{",
"return",
"$",
"this",
"->",
"executeArtaxEndpoint",
"(",
"new",
"SystemEvent... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/DockerAsync.php#L34-L37 |
docker-php/docker-php | src/DockerAsync.php | DockerAsync.executeArtaxEndpoint | public function executeArtaxEndpoint(AmpArtaxEndpoint $endpoint, string $fetch = self::FETCH_OBJECT): Promise
{
return call(function () use ($endpoint, $fetch) {
[$bodyHeaders, $body] = $endpoint->getBody($this->serializer);
$queryString = $endpoint->getQueryString();
$ur... | php | public function executeArtaxEndpoint(AmpArtaxEndpoint $endpoint, string $fetch = self::FETCH_OBJECT): Promise
{
return call(function () use ($endpoint, $fetch) {
[$bodyHeaders, $body] = $endpoint->getBody($this->serializer);
$queryString = $endpoint->getQueryString();
$ur... | [
"public",
"function",
"executeArtaxEndpoint",
"(",
"AmpArtaxEndpoint",
"$",
"endpoint",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
":",
"Promise",
"{",
"return",
"call",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"endpoint",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/DockerAsync.php#L42-L73 |
docker-php/docker-php | src/Stream/ArtaxCallbackStream.php | ArtaxCallbackStream.listen | public function listen(): Promise
{
return call(function () {
while (null !== ($chunk = yield $this->stream->read())) {
foreach ($this->onNewFrameCallables as $newFrameCallable) {
$newFrameCallable($this->transformChunk($chunk));
}
... | php | public function listen(): Promise
{
return call(function () {
while (null !== ($chunk = yield $this->stream->read())) {
foreach ($this->onNewFrameCallables as $newFrameCallable) {
$newFrameCallable($this->transformChunk($chunk));
}
... | [
"public",
"function",
"listen",
"(",
")",
":",
"Promise",
"{",
"return",
"call",
"(",
"function",
"(",
")",
"{",
"while",
"(",
"null",
"!==",
"(",
"$",
"chunk",
"=",
"yield",
"$",
"this",
"->",
"stream",
"->",
"read",
"(",
")",
")",
")",
"{",
"fo... | Consume stream chunks.
@return Promise | [
"Consume",
"stream",
"chunks",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/ArtaxCallbackStream.php#L44-L53 |
docker-php/docker-php | src/Stream/ArtaxCallbackStream.php | ArtaxCallbackStream.transformChunk | private function transformChunk(string $chunk)
{
if (null === $this->chunkTransformer) {
return $chunk;
}
return \call_user_func($this->chunkTransformer, $chunk);
} | php | private function transformChunk(string $chunk)
{
if (null === $this->chunkTransformer) {
return $chunk;
}
return \call_user_func($this->chunkTransformer, $chunk);
} | [
"private",
"function",
"transformChunk",
"(",
"string",
"$",
"chunk",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"chunkTransformer",
")",
"{",
"return",
"$",
"chunk",
";",
"}",
"return",
"\\",
"call_user_func",
"(",
"$",
"this",
"->",
"chunkT... | Transform stream chunks if required.
@param string $chunk
@return mixed The raw chunk or the transformed chunk | [
"Transform",
"stream",
"chunks",
"if",
"required",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/ArtaxCallbackStream.php#L70-L77 |
docker-php/docker-php | src/Stream/MultiJsonStream.php | MultiJsonStream.readFrame | protected function readFrame()
{
$jsonFrameEnd = false;
$lastJsonChar = '';
$inquote = false;
$jsonFrame = '';
$level = 0;
// This is a
while (!$jsonFrameEnd && !$this->stream->eof()) {
$jsonChar = $this->stream->read(1);
if ('"' === ... | php | protected function readFrame()
{
$jsonFrameEnd = false;
$lastJsonChar = '';
$inquote = false;
$jsonFrame = '';
$level = 0;
// This is a
while (!$jsonFrameEnd && !$this->stream->eof()) {
$jsonChar = $this->stream->read(1);
if ('"' === ... | [
"protected",
"function",
"readFrame",
"(",
")",
"{",
"$",
"jsonFrameEnd",
"=",
"false",
";",
"$",
"lastJsonChar",
"=",
"''",
";",
"$",
"inquote",
"=",
"false",
";",
"$",
"jsonFrame",
"=",
"''",
";",
"$",
"level",
"=",
"0",
";",
"// This is a",
"while",... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/MultiJsonStream.php#L28-L74 |
docker-php/docker-php | src/Stream/DockerRawStream.php | DockerRawStream.readFrame | protected function readFrame(): void
{
$header = $this->forceRead(8);
if (\strlen($header) < 8) {
return;
}
$decoded = \unpack('C1type/C3/N1size', $header);
$output = $this->forceRead($decoded['size']);
$callbackList = [];
if (0 === $decoded['ty... | php | protected function readFrame(): void
{
$header = $this->forceRead(8);
if (\strlen($header) < 8) {
return;
}
$decoded = \unpack('C1type/C3/N1size', $header);
$output = $this->forceRead($decoded['size']);
$callbackList = [];
if (0 === $decoded['ty... | [
"protected",
"function",
"readFrame",
"(",
")",
":",
"void",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"forceRead",
"(",
"8",
")",
";",
"if",
"(",
"\\",
"strlen",
"(",
"$",
"header",
")",
"<",
"8",
")",
"{",
"return",
";",
"}",
"$",
"decoded",
... | Read a frame in the stream. | [
"Read",
"a",
"frame",
"in",
"the",
"stream",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/DockerRawStream.php#L63-L90 |
docker-php/docker-php | src/Stream/DockerRawStream.php | DockerRawStream.forceRead | private function forceRead($length)
{
$read = '';
do {
$read .= $this->stream->read($length - \strlen($read));
} while (\strlen($read) < $length && !$this->stream->eof());
return $read;
} | php | private function forceRead($length)
{
$read = '';
do {
$read .= $this->stream->read($length - \strlen($read));
} while (\strlen($read) < $length && !$this->stream->eof());
return $read;
} | [
"private",
"function",
"forceRead",
"(",
"$",
"length",
")",
"{",
"$",
"read",
"=",
"''",
";",
"do",
"{",
"$",
"read",
".=",
"$",
"this",
"->",
"stream",
"->",
"read",
"(",
"$",
"length",
"-",
"\\",
"strlen",
"(",
"$",
"read",
")",
")",
";",
"}... | Force to have something of the expected size (block).
@param $length
@return string | [
"Force",
"to",
"have",
"something",
"of",
"the",
"expected",
"size",
"(",
"block",
")",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/DockerRawStream.php#L99-L108 |
docker-php/docker-php | src/Context/Context.php | Context.toTar | public function toTar()
{
$process = new Process('/usr/bin/env tar c .', $this->directory);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $process->getOutput();
} | php | public function toTar()
{
$process = new Process('/usr/bin/env tar c .', $this->directory);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
return $process->getOutput();
} | [
"public",
"function",
"toTar",
"(",
")",
"{",
"$",
"process",
"=",
"new",
"Process",
"(",
"'/usr/bin/env tar c .'",
",",
"$",
"this",
"->",
"directory",
")",
";",
"$",
"process",
"->",
"run",
"(",
")",
";",
"if",
"(",
"!",
"$",
"process",
"->",
"isSu... | Return the context as a tar archive.
@throws \Symfony\Component\Process\Exception\ProcessFailedException
@return string Tar content | [
"Return",
"the",
"context",
"as",
"a",
"tar",
"archive",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/Context.php#L115-L125 |
docker-php/docker-php | src/Context/Context.php | Context.toStream | public function toStream()
{
if (!\is_resource($this->process)) {
$this->process = \proc_open('/usr/bin/env tar c .', [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes, $this->directory);
$this->stream = $pipes[1];
}
return $this->stream;
} | php | public function toStream()
{
if (!\is_resource($this->process)) {
$this->process = \proc_open('/usr/bin/env tar c .', [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes, $this->directory);
$this->stream = $pipes[1];
}
return $this->stream;
} | [
"public",
"function",
"toStream",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"is_resource",
"(",
"$",
"this",
"->",
"process",
")",
")",
"{",
"$",
"this",
"->",
"process",
"=",
"\\",
"proc_open",
"(",
"'/usr/bin/env tar c .'",
",",
"[",
"[",
"'pipe'",
",",
... | Return a stream for this context.
@return resource Stream resource in memory | [
"Return",
"a",
"stream",
"for",
"this",
"context",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/Context.php#L132-L140 |
docker-php/docker-php | src/Docker.php | Docker.containerAttach | public function containerAttach(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerAttach($id, $queryParameters), $fetch);
} | php | public function containerAttach(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerAttach($id, $queryParameters), $fetch);
} | [
"public",
"function",
"containerAttach",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"executePsr7Endpoint",
"(",
"new"... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L26-L29 |
docker-php/docker-php | src/Docker.php | Docker.containerAttachWebsocket | public function containerAttachWebsocket(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerAttachWebsocket($id, $queryParameters), $fetch);
} | php | public function containerAttachWebsocket(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerAttachWebsocket($id, $queryParameters), $fetch);
} | [
"public",
"function",
"containerAttachWebsocket",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"executePsr7Endpoint",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L34-L37 |
docker-php/docker-php | src/Docker.php | Docker.containerLogs | public function containerLogs(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerLogs($id, $queryParameters), $fetch);
} | php | public function containerLogs(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ContainerLogs($id, $queryParameters), $fetch);
} | [
"public",
"function",
"containerLogs",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"executePsr7Endpoint",
"(",
"new",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L42-L45 |
docker-php/docker-php | src/Docker.php | Docker.execStart | public function execStart(string $id, \Docker\API\Model\ExecIdStartPostBody $execStartConfig, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ExecStart($id, $execStartConfig), $fetch);
} | php | public function execStart(string $id, \Docker\API\Model\ExecIdStartPostBody $execStartConfig, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ExecStart($id, $execStartConfig), $fetch);
} | [
"public",
"function",
"execStart",
"(",
"string",
"$",
"id",
",",
"\\",
"Docker",
"\\",
"API",
"\\",
"Model",
"\\",
"ExecIdStartPostBody",
"$",
"execStartConfig",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$",
"thi... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L50-L53 |
docker-php/docker-php | src/Docker.php | Docker.imageBuild | public function imageBuild($inputStream, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ImageBuild($inputStream, $queryParameters, $headerParameters), $fetch);
} | php | public function imageBuild($inputStream, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ImageBuild($inputStream, $queryParameters, $headerParameters), $fetch);
} | [
"public",
"function",
"imageBuild",
"(",
"$",
"inputStream",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"array",
"$",
"headerParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L58-L61 |
docker-php/docker-php | src/Docker.php | Docker.imageCreate | public function imageCreate(string $inputImage, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ImageCreate($inputImage, $queryParameters, $headerParameters), $fetch);
} | php | public function imageCreate(string $inputImage, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new ImageCreate($inputImage, $queryParameters, $headerParameters), $fetch);
} | [
"public",
"function",
"imageCreate",
"(",
"string",
"$",
"inputImage",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"array",
"$",
"headerParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"r... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L66-L69 |
docker-php/docker-php | src/Docker.php | Docker.imagePush | public function imagePush(string $name, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
if (isset($headerParameters['X-Registry-Auth']) && $headerParameters['X-Registry-Auth'] instanceof AuthConfig) {
$headerParameters['X-Registry-Auth'] = \base64... | php | public function imagePush(string $name, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
if (isset($headerParameters['X-Registry-Auth']) && $headerParameters['X-Registry-Auth'] instanceof AuthConfig) {
$headerParameters['X-Registry-Auth'] = \base64... | [
"public",
"function",
"imagePush",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"array",
"$",
"headerParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"if",
"(... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L74-L81 |
docker-php/docker-php | src/Docker.php | Docker.systemEvents | public function systemEvents(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new SystemEvents($queryParameters), $fetch);
} | php | public function systemEvents(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new SystemEvents($queryParameters), $fetch);
} | [
"public",
"function",
"systemEvents",
"(",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"string",
"$",
"fetch",
"=",
"self",
"::",
"FETCH_OBJECT",
")",
"{",
"return",
"$",
"this",
"->",
"executePsr7Endpoint",
"(",
"new",
"SystemEvents",
"(",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Docker.php#L86-L89 |
docker-php/docker-php | src/Stream/AttachWebsocketStream.php | AttachWebsocketStream.write | public function write($data): void
{
$rand = \random_int(0, 28);
$frame = [
'fin' => 1,
'rsv1' => 0,
'rsv2' => 0,
'rsv3' => 0,
'opcode' => 1, // We always send text
'mask' => 1,
'len' => \strlen($data),
'... | php | public function write($data): void
{
$rand = \random_int(0, 28);
$frame = [
'fin' => 1,
'rsv1' => 0,
'rsv2' => 0,
'rsv3' => 0,
'opcode' => 1, // We always send text
'mask' => 1,
'len' => \strlen($data),
'... | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
":",
"void",
"{",
"$",
"rand",
"=",
"\\",
"random_int",
"(",
"0",
",",
"28",
")",
";",
"$",
"frame",
"=",
"[",
"'fin'",
"=>",
"1",
",",
"'rsv1'",
"=>",
"0",
",",
"'rsv2'",
"=>",
"0",
",",
... | Send input to the container.
@param string $data Data to send | [
"Send",
"input",
"to",
"the",
"container",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/AttachWebsocketStream.php#L31-L81 |
docker-php/docker-php | src/Stream/AttachWebsocketStream.php | AttachWebsocketStream.read | public function read($waitTime = 0, $waitMicroTime = 200000, $getFrame = false)
{
if (!\is_resource($this->socket) || \feof($this->socket)) {
return null;
}
$read = [$this->socket];
$write = null;
$expect = null;
if (0 === \stream_select($read, $write, $... | php | public function read($waitTime = 0, $waitMicroTime = 200000, $getFrame = false)
{
if (!\is_resource($this->socket) || \feof($this->socket)) {
return null;
}
$read = [$this->socket];
$write = null;
$expect = null;
if (0 === \stream_select($read, $write, $... | [
"public",
"function",
"read",
"(",
"$",
"waitTime",
"=",
"0",
",",
"$",
"waitMicroTime",
"=",
"200000",
",",
"$",
"getFrame",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"\\",
"is_resource",
"(",
"$",
"this",
"->",
"socket",
")",
"||",
"\\",
"feof",
"(... | Block until it receive a frame from websocket or return null if no more connexion.
@param int $waitTime Time to wait in seconds before return false
@param int $waitMicroTime Time to wait in microseconds before return false
@param bool $getFrame Whether to return the frame of websocket or only the data
@re... | [
"Block",
"until",
"it",
"receive",
"a",
"frame",
"from",
"websocket",
"or",
"return",
"null",
"if",
"no",
"more",
"connexion",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/AttachWebsocketStream.php#L92-L149 |
docker-php/docker-php | src/Stream/AttachWebsocketStream.php | AttachWebsocketStream.socketRead | private function socketRead($length)
{
$read = '';
do {
$read .= \fread($this->socket, $length - \strlen($read));
} while (\strlen($read) < $length && !\feof($this->socket));
return $read;
} | php | private function socketRead($length)
{
$read = '';
do {
$read .= \fread($this->socket, $length - \strlen($read));
} while (\strlen($read) < $length && !\feof($this->socket));
return $read;
} | [
"private",
"function",
"socketRead",
"(",
"$",
"length",
")",
"{",
"$",
"read",
"=",
"''",
";",
"do",
"{",
"$",
"read",
".=",
"\\",
"fread",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"length",
"-",
"\\",
"strlen",
"(",
"$",
"read",
")",
")",
... | Force to have something of the expected size (block).
@param $length
@return string | [
"Force",
"to",
"have",
"something",
"of",
"the",
"expected",
"size",
"(",
"block",
")",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Stream/AttachWebsocketStream.php#L158-L167 |
docker-php/docker-php | src/DockerClientFactory.php | DockerClientFactory.create | public static function create(array $config = [], PluginClientFactory $pluginClientFactory = null): HttpClient
{
if (!\array_key_exists('remote_socket', $config)) {
$config['remote_socket'] = 'unix:///var/run/docker.sock';
}
$messageFactory = new GuzzleMessageFactory();
... | php | public static function create(array $config = [], PluginClientFactory $pluginClientFactory = null): HttpClient
{
if (!\array_key_exists('remote_socket', $config)) {
$config['remote_socket'] = 'unix:///var/run/docker.sock';
}
$messageFactory = new GuzzleMessageFactory();
... | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
",",
"PluginClientFactory",
"$",
"pluginClientFactory",
"=",
"null",
")",
":",
"HttpClient",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"'remote_socket'",
",",
"$"... | ( . | [
"(",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/DockerClientFactory.php#L21-L40 |
docker-php/docker-php | src/Context/ContextBuilder.php | ContextBuilder.getContext | public function getContext()
{
$directory = \sys_get_temp_dir().'/ctb-'.\microtime();
$this->fs->mkdir($directory);
$this->write($directory);
$result = new Context($directory, $this->format, $this->fs);
$result->setCleanup(true);
return $result;
} | php | public function getContext()
{
$directory = \sys_get_temp_dir().'/ctb-'.\microtime();
$this->fs->mkdir($directory);
$this->write($directory);
$result = new Context($directory, $this->format, $this->fs);
$result->setCleanup(true);
return $result;
} | [
"public",
"function",
"getContext",
"(",
")",
"{",
"$",
"directory",
"=",
"\\",
"sys_get_temp_dir",
"(",
")",
".",
"'/ctb-'",
".",
"\\",
"microtime",
"(",
")",
";",
"$",
"this",
"->",
"fs",
"->",
"mkdir",
"(",
"$",
"directory",
")",
";",
"$",
"this",... | Create context given the state of builder.
@return \Docker\Context\Context | [
"Create",
"context",
"given",
"the",
"state",
"of",
"builder",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/ContextBuilder.php#L256-L266 |
docker-php/docker-php | src/Context/ContextBuilder.php | ContextBuilder.write | private function write($directory): void
{
$dockerfile = [];
// Insert a FROM instruction if the file does not start with one.
if (empty($this->commands) || $this->commands[0]['type'] !== 'FROM') {
$dockerfile[] = 'FROM base';
}
foreach ($this->commands as $comman... | php | private function write($directory): void
{
$dockerfile = [];
// Insert a FROM instruction if the file does not start with one.
if (empty($this->commands) || $this->commands[0]['type'] !== 'FROM') {
$dockerfile[] = 'FROM base';
}
foreach ($this->commands as $comman... | [
"private",
"function",
"write",
"(",
"$",
"directory",
")",
":",
"void",
"{",
"$",
"dockerfile",
"=",
"[",
"]",
";",
"// Insert a FROM instruction if the file does not start with one.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"commands",
")",
"||",
"$",
"t... | Write docker file and associated files in a directory.
@param string $directory Target directory
@void | [
"Write",
"docker",
"file",
"and",
"associated",
"files",
"in",
"a",
"directory",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/ContextBuilder.php#L275-L329 |
docker-php/docker-php | src/Context/ContextBuilder.php | ContextBuilder.getFile | private function getFile($directory, $content)
{
$hash = \md5($content);
if (!\array_key_exists($hash, $this->files)) {
$file = \tempnam($directory, '');
$this->fs->dumpFile($file, $content);
$this->files[$hash] = \basename($file);
}
return $this... | php | private function getFile($directory, $content)
{
$hash = \md5($content);
if (!\array_key_exists($hash, $this->files)) {
$file = \tempnam($directory, '');
$this->fs->dumpFile($file, $content);
$this->files[$hash] = \basename($file);
}
return $this... | [
"private",
"function",
"getFile",
"(",
"$",
"directory",
",",
"$",
"content",
")",
"{",
"$",
"hash",
"=",
"\\",
"md5",
"(",
"$",
"content",
")",
";",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"hash",
",",
"$",
"this",
"->",
"files",
")",
... | Generate a file in a directory.
@param string $directory Targeted directory
@param string $content Content of file
@return string Name of file generated | [
"Generate",
"a",
"file",
"in",
"a",
"directory",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/ContextBuilder.php#L339-L350 |
docker-php/docker-php | src/Context/ContextBuilder.php | ContextBuilder.getFileFromStream | private function getFileFromStream($directory, $stream)
{
$file = \tempnam($directory, '');
$target = \fopen($file, 'w');
if (0 === \stream_copy_to_stream($stream, $target)) {
throw new \RuntimeException('Failed to write stream to file');
}
\fclose($target);
... | php | private function getFileFromStream($directory, $stream)
{
$file = \tempnam($directory, '');
$target = \fopen($file, 'w');
if (0 === \stream_copy_to_stream($stream, $target)) {
throw new \RuntimeException('Failed to write stream to file');
}
\fclose($target);
... | [
"private",
"function",
"getFileFromStream",
"(",
"$",
"directory",
",",
"$",
"stream",
")",
"{",
"$",
"file",
"=",
"\\",
"tempnam",
"(",
"$",
"directory",
",",
"''",
")",
";",
"$",
"target",
"=",
"\\",
"fopen",
"(",
"$",
"file",
",",
"'w'",
")",
";... | Generated a file in a directory from a stream.
@param string $directory Targeted directory
@param resource $stream Stream containing file contents
@return string Name of file generated | [
"Generated",
"a",
"file",
"in",
"a",
"directory",
"from",
"a",
"stream",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/ContextBuilder.php#L360-L370 |
docker-php/docker-php | src/Context/ContextBuilder.php | ContextBuilder.getFileFromDisk | private function getFileFromDisk($directory, $source)
{
$hash = 'DISK-'.\md5(\realpath($source));
if (!\array_key_exists($hash, $this->files)) {
// Check if source is a directory or a file.
if (\is_dir($source)) {
$this->fs->mirror($source, $directory.'/'.$has... | php | private function getFileFromDisk($directory, $source)
{
$hash = 'DISK-'.\md5(\realpath($source));
if (!\array_key_exists($hash, $this->files)) {
// Check if source is a directory or a file.
if (\is_dir($source)) {
$this->fs->mirror($source, $directory.'/'.$has... | [
"private",
"function",
"getFileFromDisk",
"(",
"$",
"directory",
",",
"$",
"source",
")",
"{",
"$",
"hash",
"=",
"'DISK-'",
".",
"\\",
"md5",
"(",
"\\",
"realpath",
"(",
"$",
"source",
")",
")",
";",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$"... | Generated a file in a directory from an existing file.
@param string $directory Targeted directory
@param string $source Path to the source file
@return string Name of file generated | [
"Generated",
"a",
"file",
"in",
"a",
"directory",
"from",
"an",
"existing",
"file",
"."
] | train | https://github.com/docker-php/docker-php/blob/cd8e3096a7a12419fde423adb77eb79db78d1ac5/src/Context/ContextBuilder.php#L380-L395 |
alihesari/laravel-social-auto-posting | src/Facebook/Api.php | Api.sendLink | public static function sendLink($link, $message = '')
{
self::initialize();
$data = compact('link', 'message');
try {
$response = self::$fb->post('/me/feed', $data, self::$page_access_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
throw ne... | php | public static function sendLink($link, $message = '')
{
self::initialize();
$data = compact('link', 'message');
try {
$response = self::$fb->post('/me/feed', $data, self::$page_access_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
throw ne... | [
"public",
"static",
"function",
"sendLink",
"(",
"$",
"link",
",",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"initialize",
"(",
")",
";",
"$",
"data",
"=",
"compact",
"(",
"'link'",
",",
"'message'",
")",
";",
"try",
"{",
"$",
"response",
... | Send link and text message
@param $link
@param $message
@return bool
@throws \Exception | [
"Send",
"link",
"and",
"text",
"message"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Facebook/Api.php#L62-L76 |
alihesari/laravel-social-auto-posting | src/Facebook/Api.php | Api.sendPhoto | public static function sendPhoto($photo ,$message = ''){
self::initialize();
$data = [
'message' => $message,
'source' => self::$fb->fileToUpload($photo)
];
try {
$response = self::$fb->post('/me/photos', $data, self::$page_access_token);
} cat... | php | public static function sendPhoto($photo ,$message = ''){
self::initialize();
$data = [
'message' => $message,
'source' => self::$fb->fileToUpload($photo)
];
try {
$response = self::$fb->post('/me/photos', $data, self::$page_access_token);
} cat... | [
"public",
"static",
"function",
"sendPhoto",
"(",
"$",
"photo",
",",
"$",
"message",
"=",
"''",
")",
"{",
"self",
"::",
"initialize",
"(",
")",
";",
"$",
"data",
"=",
"[",
"'message'",
"=>",
"$",
"message",
",",
"'source'",
"=>",
"self",
"::",
"$",
... | Send photo and text message
@param $photo
@param string $message
@return bool
@throws \Exception | [
"Send",
"photo",
"and",
"text",
"message"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Facebook/Api.php#L86-L102 |
alihesari/laravel-social-auto-posting | src/Facebook/Api.php | Api.sendVideo | public static function sendVideo($video , $title = '', $description = ''){
self::initialize();
$data = compact('title','description');
try {
$response = self::$fb->uploadVideo('me', $video,$data, self::$page_access_token);
} catch(Facebook\Exceptions\FacebookResponseException... | php | public static function sendVideo($video , $title = '', $description = ''){
self::initialize();
$data = compact('title','description');
try {
$response = self::$fb->uploadVideo('me', $video,$data, self::$page_access_token);
} catch(Facebook\Exceptions\FacebookResponseException... | [
"public",
"static",
"function",
"sendVideo",
"(",
"$",
"video",
",",
"$",
"title",
"=",
"''",
",",
"$",
"description",
"=",
"''",
")",
"{",
"self",
"::",
"initialize",
"(",
")",
";",
"$",
"data",
"=",
"compact",
"(",
"'title'",
",",
"'description'",
... | Send video
@param $video
@param string $title
@param string $description
@return mixed
@throws \Exception | [
"Send",
"video"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Facebook/Api.php#L113-L126 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthRequest.from_request | public static function from_request($http_method = null, $http_url = null, $parameters = null)
{
$scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
? 'http'
: 'https';
$http_url = ($http_url) ? $http_url : $scheme .
'://' . $_SERVER['HTTP_HOST'] .
... | php | public static function from_request($http_method = null, $http_url = null, $parameters = null)
{
$scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
? 'http'
: 'https';
$http_url = ($http_url) ? $http_url : $scheme .
'://' . $_SERVER['HTTP_HOST'] .
... | [
"public",
"static",
"function",
"from_request",
"(",
"$",
"http_method",
"=",
"null",
",",
"$",
"http_url",
"=",
"null",
",",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"scheme",
"=",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
"... | attempt to build up a request from what was passed to the server | [
"attempt",
"to",
"build",
"up",
"a",
"request",
"from",
"what",
"was",
"passed",
"to",
"the",
"server"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L301-L348 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthRequest.get_signable_parameters | public function get_signable_parameters()
{
// Grab all parameters
$params = $this->parameters;
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
if (isset($params['oauth_signature'])) {
unset($params['oa... | php | public function get_signable_parameters()
{
// Grab all parameters
$params = $this->parameters;
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
if (isset($params['oauth_signature'])) {
unset($params['oa... | [
"public",
"function",
"get_signable_parameters",
"(",
")",
"{",
"// Grab all parameters",
"$",
"params",
"=",
"$",
"this",
"->",
"parameters",
";",
"// Remove oauth_signature if present",
"// Ref: Spec: 9.1.1 (\"The oauth_signature parameter MUST be excluded.\")",
"if",
"(",
"i... | The request parameters, sorted and concatenated into a normalized string.
@return string | [
"The",
"request",
"parameters",
"sorted",
"and",
"concatenated",
"into",
"a",
"normalized",
"string",
"."
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L410-L422 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.get_version | private function get_version(&$request)
{
$version = $request->get_parameter('oauth_version');
if (!$version) {
// Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
// Chapter 7.0 ("Accessing Protected Ressources")
$ver... | php | private function get_version(&$request)
{
$version = $request->get_parameter('oauth_version');
if (!$version) {
// Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
// Chapter 7.0 ("Accessing Protected Ressources")
$ver... | [
"private",
"function",
"get_version",
"(",
"&",
"$",
"request",
")",
"{",
"$",
"version",
"=",
"$",
"request",
"->",
"get_parameter",
"(",
"'oauth_version'",
")",
";",
"if",
"(",
"!",
"$",
"version",
")",
"{",
"// Service Providers MUST assume the protocol versi... | version 1 | [
"version",
"1"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L667-L679 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.get_signature_method | private function get_signature_method($request)
{
$signature_method = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_signature_method')
: null;
if (!$signature_method) {
// According to chapter 7 ("Accessing Protected Ressources") the s... | php | private function get_signature_method($request)
{
$signature_method = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_signature_method')
: null;
if (!$signature_method) {
// According to chapter 7 ("Accessing Protected Ressources") the s... | [
"private",
"function",
"get_signature_method",
"(",
"$",
"request",
")",
"{",
"$",
"signature_method",
"=",
"$",
"request",
"instanceof",
"Twitter_OAuthRequest",
"?",
"$",
"request",
"->",
"get_parameter",
"(",
"'oauth_signature_method'",
")",
":",
"null",
";",
"i... | figure out the signature with some defaults | [
"figure",
"out",
"the",
"signature",
"with",
"some",
"defaults"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L685-L706 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.get_consumer | private function get_consumer($request)
{
$consumer_key = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_consumer_key')
: null;
if (!$consumer_key) {
throw new Twitter_OAuthException('Invalid consumer key');
}
$consumer... | php | private function get_consumer($request)
{
$consumer_key = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_consumer_key')
: null;
if (!$consumer_key) {
throw new Twitter_OAuthException('Invalid consumer key');
}
$consumer... | [
"private",
"function",
"get_consumer",
"(",
"$",
"request",
")",
"{",
"$",
"consumer_key",
"=",
"$",
"request",
"instanceof",
"Twitter_OAuthRequest",
"?",
"$",
"request",
"->",
"get_parameter",
"(",
"'oauth_consumer_key'",
")",
":",
"null",
";",
"if",
"(",
"!"... | try to find the consumer for the provided request's consumer key | [
"try",
"to",
"find",
"the",
"consumer",
"for",
"the",
"provided",
"request",
"s",
"consumer",
"key"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L712-L728 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.get_token | private function get_token($request, $consumer, $token_type = 'access')
{
$token_field = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_token')
: null;
$token = $this->data_store->lookup_token(
$consumer, $token_type, $token_field
... | php | private function get_token($request, $consumer, $token_type = 'access')
{
$token_field = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_token')
: null;
$token = $this->data_store->lookup_token(
$consumer, $token_type, $token_field
... | [
"private",
"function",
"get_token",
"(",
"$",
"request",
",",
"$",
"consumer",
",",
"$",
"token_type",
"=",
"'access'",
")",
"{",
"$",
"token_field",
"=",
"$",
"request",
"instanceof",
"Twitter_OAuthRequest",
"?",
"$",
"request",
"->",
"get_parameter",
"(",
... | try to find the token for the provided request's token key | [
"try",
"to",
"find",
"the",
"token",
"for",
"the",
"provided",
"request",
"s",
"token",
"key"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L734-L747 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.check_signature | private function check_signature($request, $consumer, $token)
{
// this should probably be in a different method
$timestamp = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_timestamp')
: null;
$nonce = $request instanceof Twitter_OAuthReques... | php | private function check_signature($request, $consumer, $token)
{
// this should probably be in a different method
$timestamp = $request instanceof Twitter_OAuthRequest
? $request->get_parameter('oauth_timestamp')
: null;
$nonce = $request instanceof Twitter_OAuthReques... | [
"private",
"function",
"check_signature",
"(",
"$",
"request",
",",
"$",
"consumer",
",",
"$",
"token",
")",
"{",
"// this should probably be in a different method",
"$",
"timestamp",
"=",
"$",
"request",
"instanceof",
"Twitter_OAuthRequest",
"?",
"$",
"request",
"-... | all-in-one function to check the signature on a request
should guess the signature method appropriately | [
"all",
"-",
"in",
"-",
"one",
"function",
"to",
"check",
"the",
"signature",
"on",
"a",
"request",
"should",
"guess",
"the",
"signature",
"method",
"appropriately"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L754-L780 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthServer.check_timestamp | private function check_timestamp($timestamp)
{
if (!$timestamp) {
throw new Twitter_OAuthException(
'Missing timestamp parameter. The parameter is required'
);
}
// verify that timestamp is recentish
$now = time();
if (abs($now - $time... | php | private function check_timestamp($timestamp)
{
if (!$timestamp) {
throw new Twitter_OAuthException(
'Missing timestamp parameter. The parameter is required'
);
}
// verify that timestamp is recentish
$now = time();
if (abs($now - $time... | [
"private",
"function",
"check_timestamp",
"(",
"$",
"timestamp",
")",
"{",
"if",
"(",
"!",
"$",
"timestamp",
")",
"{",
"throw",
"new",
"Twitter_OAuthException",
"(",
"'Missing timestamp parameter. The parameter is required'",
")",
";",
"}",
"// verify that timestamp is ... | check that the timestamp is new enough | [
"check",
"that",
"the",
"timestamp",
"is",
"new",
"enough"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L786-L801 |
alihesari/laravel-social-auto-posting | src/Twitter/OAuth.php | Twitter_OAuthUtil.parse_parameters | public static function parse_parameters($input)
{
if (!isset($input) || !$input) {
return [];
}
$pairs = explode('&', $input);
$parsed_parameters = [];
foreach ($pairs as $pair) {
$split = explode('=', $pair, 2);
$parameter = self::urldec... | php | public static function parse_parameters($input)
{
if (!isset($input) || !$input) {
return [];
}
$pairs = explode('&', $input);
$parsed_parameters = [];
foreach ($pairs as $pair) {
$split = explode('=', $pair, 2);
$parameter = self::urldec... | [
"public",
"static",
"function",
"parse_parameters",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"input",
")",
"||",
"!",
"$",
"input",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"pairs",
"=",
"explode",
"(",
"'&'",
",",
"$",... | ['a' => array('b','c'), 'd' => 'e'] | [
"[",
"a",
"=",
">",
"array",
"(",
"b",
"c",
")",
"d",
"=",
">",
"e",
"]"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/OAuth.php#L965-L995 |
alihesari/laravel-social-auto-posting | src/Twitter/Api.php | Api.initialize | public static function initialize()
{
if (!extension_loaded('curl')) {
throw new TwitterException('PHP extension CURL is not loaded.');
}
self::$consumerKey = Config::get('larasap.twitter.consurmer_key');
self::$consumerSecret = Config::get('larasap.twitter.consurmer_sec... | php | public static function initialize()
{
if (!extension_loaded('curl')) {
throw new TwitterException('PHP extension CURL is not loaded.');
}
self::$consumerKey = Config::get('larasap.twitter.consurmer_key');
self::$consumerSecret = Config::get('larasap.twitter.consurmer_sec... | [
"public",
"static",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'curl'",
")",
")",
"{",
"throw",
"new",
"TwitterException",
"(",
"'PHP extension CURL is not loaded.'",
")",
";",
"}",
"self",
"::",
"$",
"consumerKey",
"=",... | Initialize | [
"Initialize"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/Api.php#L49-L62 |
alihesari/laravel-social-auto-posting | src/Twitter/Api.php | Api.sendMessage | public static function sendMessage($message, $media = [], $options = [])
{
self::initialize();
$mediaIds = [];
foreach ($media as $item) {
$res = self::request(
'https://upload.twitter.com/1.1/media/upload.json',
'POST',
null,
... | php | public static function sendMessage($message, $media = [], $options = [])
{
self::initialize();
$mediaIds = [];
foreach ($media as $item) {
$res = self::request(
'https://upload.twitter.com/1.1/media/upload.json',
'POST',
null,
... | [
"public",
"static",
"function",
"sendMessage",
"(",
"$",
"message",
",",
"$",
"media",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"self",
"::",
"initialize",
"(",
")",
";",
"$",
"mediaIds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$... | Sends message to the Twitter.
@param string message encoded in UTF-8
@param string path to local media file to be uploaded
@param array additional options to send to statuses/update
@return stdClass see https://dev.twitter.com/rest/reference/post/statuses/update
@throws TwitterException | [
"Sends",
"message",
"to",
"the",
"Twitter",
"."
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/Api.php#L72-L91 |
alihesari/laravel-social-auto-posting | src/Twitter/Api.php | Api.request | public static function request($resource, $method, array $data = null, array $files = null)
{
if (!strpos($resource, '://')) {
if (!strpos($resource, '.')) {
$resource .= '.json';
}
$resource = self::API_URL . $resource;
}
$hasCURLFile = c... | php | public static function request($resource, $method, array $data = null, array $files = null)
{
if (!strpos($resource, '://')) {
if (!strpos($resource, '.')) {
$resource .= '.json';
}
$resource = self::API_URL . $resource;
}
$hasCURLFile = c... | [
"public",
"static",
"function",
"request",
"(",
"$",
"resource",
",",
"$",
"method",
",",
"array",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"files",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"strpos",
"(",
"$",
"resource",
",",
"'://'",
")",
")",
... | Process HTTP request.
@param string URL or twitter command
@param string HTTP method GET or POST
@param array data
@param array uploaded files
@return stdClass|stdClass[]
@throws TwitterException | [
"Process",
"HTTP",
"request",
"."
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Twitter/Api.php#L102-L171 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.initialize | public static function initialize()
{
self::$api_token = Config::get('larasap.telegram.api_token');
self::$bot_username = Config::get('larasap.telegram.bot_username');
self::$channel_username = Config::get('larasap.telegram.channel_username');
self::$proxy = !! Config::get('larasap.t... | php | public static function initialize()
{
self::$api_token = Config::get('larasap.telegram.api_token');
self::$bot_username = Config::get('larasap.telegram.bot_username');
self::$channel_username = Config::get('larasap.telegram.channel_username');
self::$proxy = !! Config::get('larasap.t... | [
"public",
"static",
"function",
"initialize",
"(",
")",
"{",
"self",
"::",
"$",
"api_token",
"=",
"Config",
"::",
"get",
"(",
"'larasap.telegram.api_token'",
")",
";",
"self",
"::",
"$",
"bot_username",
"=",
"Config",
"::",
"get",
"(",
"'larasap.telegram.bot_u... | Initialize | [
"Initialize"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L69-L75 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendMessage | public static function sendMessage($chat_id = null, $text, $inline_keyboard = '', $reply_keyboard = '', $parse_mode = 'HTML', $disable_web_page_preview = false, $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | php | public static function sendMessage($chat_id = null, $text, $inline_keyboard = '', $reply_keyboard = '', $parse_mode = 'HTML', $disable_web_page_preview = false, $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | [
"public",
"static",
"function",
"sendMessage",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"text",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
"reply_keyboard",
"=",
"''",
",",
"$",
"parse_mode",
"=",
"'HTML'",
",",
"$",
"disable_web_page_preview",
"... | Send text messages
@param null $chat_id
@param $text - max length 4096 characters
@param string $inline_keyboard
@param string $reply_keyboard
@param string $parse_mode
@param int $reply_to_message_id
@param bool $display_web_page_preview
@return bool|mixed | [
"Send",
"text",
"messages"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L89-L102 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendAudio | public static function sendAudio($chat_id = null, $audio, $caption = '', $duration = '', $performer = '', $title = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username... | php | public static function sendAudio($chat_id = null, $audio, $caption = '', $duration = '', $performer = '', $title = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username... | [
"public",
"static",
"function",
"sendAudio",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"audio",
",",
"$",
"caption",
"=",
"''",
",",
"$",
"duration",
"=",
"''",
",",
"$",
"performer",
"=",
"''",
",",
"$",
"title",
"=",
"''",
",",
"$",
"inline_key... | Send audio
@param null $chat_id
@param $audio
@param string $caption
@param string $duration
@param string $performer
@param string $title
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"audio"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L145-L159 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendDocument | public static function sendDocument($chat_id = null, $document, $caption = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('chat_id','d... | php | public static function sendDocument($chat_id = null, $document, $caption = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('chat_id','d... | [
"public",
"static",
"function",
"sendDocument",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"document",
",",
"$",
"caption",
"=",
"''",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
"reply_keyboard",
"=",
"''",
",",
"$",
"disable_notification",
"=",
... | Send document
@param null $chat_id
@param $document
@param string $caption
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"document"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L173-L186 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendVideo | public static function sendVideo($chat_id = null, $video, $duration = '', $width = '', $height = '', $caption = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | php | public static function sendVideo($chat_id = null, $video, $duration = '', $width = '', $height = '', $caption = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | [
"public",
"static",
"function",
"sendVideo",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"video",
",",
"$",
"duration",
"=",
"''",
",",
"$",
"width",
"=",
"''",
",",
"$",
"height",
"=",
"''",
",",
"$",
"caption",
"=",
"''",
",",
"$",
"inline_keyboa... | Send video
@param null $chat_id
@param $video
@param string $duration
@param string $width
@param string $height
@param string $caption
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"video"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L203-L216 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendVoice | public static function sendVoice($chat_id = null, $voice, $caption = '', $duration = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('c... | php | public static function sendVoice($chat_id = null, $voice, $caption = '', $duration = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('c... | [
"public",
"static",
"function",
"sendVoice",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"voice",
",",
"$",
"caption",
"=",
"''",
",",
"$",
"duration",
"=",
"''",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
"reply_keyboard",
"=",
"''",
",",
"$"... | Send voice
@param null $chat_id
@param $voice
@param string $caption
@param string $duration
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"voice"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L231-L244 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendMediaGroup | public static function sendMediaGroup($chat_id = null, $media, $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('chat_id','media', 'disable_notification', 'reply_to_message_id');
... | php | public static function sendMediaGroup($chat_id = null, $media, $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact('chat_id','media', 'disable_notification', 'reply_to_message_id');
... | [
"public",
"static",
"function",
"sendMediaGroup",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"media",
",",
"$",
"disable_notification",
"=",
"false",
",",
"$",
"reply_to_message_id",
"=",
"''",
")",
"{",
"self",
"::",
"initialize",
"(",
")",
";",
"$",
"... | Send media group
@param null $chat_id
@param $media
@param bool $disable_notification
@param string $reply_to_message_id
@return bool|mixed | [
"Send",
"media",
"group"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L255-L262 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendLocation | public static function sendLocation($chat_id = null, $latitude, $longitude, $live_period = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = comp... | php | public static function sendLocation($chat_id = null, $latitude, $longitude, $live_period = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = comp... | [
"public",
"static",
"function",
"sendLocation",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"latitude",
",",
"$",
"longitude",
",",
"$",
"live_period",
"=",
"''",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
"reply_keyboard",
"=",
"''",
",",
"$",
... | Send location
@param null $chat_id
@param $latitude
@param $longitude
@param $live_period
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"location"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L277-L290 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendVenue | public static function sendVenue($chat_id = null, $latitude, $longitude, $title, $address, $foursquare_id = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | php | public static function sendVenue($chat_id = null, $latitude, $longitude, $title, $address, $foursquare_id = '', $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
... | [
"public",
"static",
"function",
"sendVenue",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"latitude",
",",
"$",
"longitude",
",",
"$",
"title",
",",
"$",
"address",
",",
"$",
"foursquare_id",
"=",
"''",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
... | Send venue
@param null $chat_id
@param $latitude
@param $longitude
@param $title
@param $address
@param string $foursquare_id
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"venue"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L307-L320 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendContact | public static function sendContact($chat_id = null, $phone_number, $first_name, $last_name, $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact... | php | public static function sendContact($chat_id = null, $phone_number, $first_name, $last_name, $inline_keyboard = '', $reply_keyboard = '', $disable_notification = false, $reply_to_message_id = '')
{
self::initialize();
$chat_id = $chat_id ? $chat_id : self::$channel_username;
$params = compact... | [
"public",
"static",
"function",
"sendContact",
"(",
"$",
"chat_id",
"=",
"null",
",",
"$",
"phone_number",
",",
"$",
"first_name",
",",
"$",
"last_name",
",",
"$",
"inline_keyboard",
"=",
"''",
",",
"$",
"reply_keyboard",
"=",
"''",
",",
"$",
"disable_noti... | Send contact
@param null $chat_id
@param $phone_number
@param $first_name
@param $last_name
@param bool $disable_notification
@param string $reply_to_message_id
@param string $inline_keyboard
@param string $reply_keyboard
@return bool|mixed | [
"Send",
"contact"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L335-L348 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.setProxy | public static function setProxy()
{
return [
CURLOPT_PROXY => Config::get('larasap.proxy.hostname' , '127.0.0.1'),
CURLOPT_PROXYPORT => Config::get('larasap.proxy.port' , '9050'),
CURLOPT_PROXYTYPE => Config::get('larasap.proxy.type' , CURLPROXY_SOCKS5_HOSTNAME),
... | php | public static function setProxy()
{
return [
CURLOPT_PROXY => Config::get('larasap.proxy.hostname' , '127.0.0.1'),
CURLOPT_PROXYPORT => Config::get('larasap.proxy.port' , '9050'),
CURLOPT_PROXYTYPE => Config::get('larasap.proxy.type' , CURLPROXY_SOCKS5_HOSTNAME),
... | [
"public",
"static",
"function",
"setProxy",
"(",
")",
"{",
"return",
"[",
"CURLOPT_PROXY",
"=>",
"Config",
"::",
"get",
"(",
"'larasap.proxy.hostname'",
",",
"'127.0.0.1'",
")",
",",
"CURLOPT_PROXYPORT",
"=>",
"Config",
"::",
"get",
"(",
"'larasap.proxy.port'",
... | Set Proxy
@return array | [
"Set",
"Proxy"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L379-L388 |
alihesari/laravel-social-auto-posting | src/Telegram/Api.php | Api.sendRequest | public static function sendRequest($method = 'sendMessage', $params)
{
$curl = curl_init(self::$api_url . self::$api_token . '/'. $method);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_seto... | php | public static function sendRequest($method = 'sendMessage', $params)
{
$curl = curl_init(self::$api_url . self::$api_token . '/'. $method);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_seto... | [
"public",
"static",
"function",
"sendRequest",
"(",
"$",
"method",
"=",
"'sendMessage'",
",",
"$",
"params",
")",
"{",
"$",
"curl",
"=",
"curl_init",
"(",
"self",
"::",
"$",
"api_url",
".",
"self",
"::",
"$",
"api_token",
".",
"'/'",
".",
"$",
"method"... | Send Request to Telegram api
@param string $method
@param $params
@return mixed
@throws \Exception | [
"Send",
"Request",
"to",
"Telegram",
"api"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/Telegram/Api.php#L398-L424 |
alihesari/laravel-social-auto-posting | src/SendTo.php | SendTo.Telegram | public static function Telegram($text, $attachment = '', $inline_keyboard = '')
{
if (Config::get('larasap.telegram.channel_signature')) {
$type = isset($attachment['type']) ? 'caption' : 'text';
$text = self::assignSignature($text, $type);
}
if ($attachment) {
... | php | public static function Telegram($text, $attachment = '', $inline_keyboard = '')
{
if (Config::get('larasap.telegram.channel_signature')) {
$type = isset($attachment['type']) ? 'caption' : 'text';
$text = self::assignSignature($text, $type);
}
if ($attachment) {
... | [
"public",
"static",
"function",
"Telegram",
"(",
"$",
"text",
",",
"$",
"attachment",
"=",
"''",
",",
"$",
"inline_keyboard",
"=",
"''",
")",
"{",
"if",
"(",
"Config",
"::",
"get",
"(",
"'larasap.telegram.channel_signature'",
")",
")",
"{",
"$",
"type",
... | Sent to Telegram
@param $text
@param string $attachment
@param string $inline_keyboard
@return bool|mixed | [
"Sent",
"to",
"Telegram"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/SendTo.php#L31-L83 |
alihesari/laravel-social-auto-posting | src/SendTo.php | SendTo.Facebook | public static function Facebook($type, $data)
{
switch ($type) {
case 'link':
$message = isset($data['message']) ? $data['message'] : '';
$result = FacebookApi::sendLink($data['link'], $data['message']);
break;
case 'photo':
... | php | public static function Facebook($type, $data)
{
switch ($type) {
case 'link':
$message = isset($data['message']) ? $data['message'] : '';
$result = FacebookApi::sendLink($data['link'], $data['message']);
break;
case 'photo':
... | [
"public",
"static",
"function",
"Facebook",
"(",
"$",
"type",
",",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'link'",
":",
"$",
"message",
"=",
"isset",
"(",
"$",
"data",
"[",
"'message'",
"]",
")",
"?",
"$",
"data",
"... | Send message to Facebook page
@param $type
@param $data
@return bool | [
"Send",
"message",
"to",
"Facebook",
"page"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/SendTo.php#L105-L123 |
alihesari/laravel-social-auto-posting | src/SendTo.php | SendTo.assignSignature | public static function assignSignature($text, $type)
{
$signature = "\n" . Config::get('larasap.telegram.channel_signature');
$signature_length = strlen($signature);
$text_length = strlen($text);
$max_length = ($type == 'text') ? TelegramApi::TEXT_LENGTH : TelegramApi::CAPTION_LENGTH... | php | public static function assignSignature($text, $type)
{
$signature = "\n" . Config::get('larasap.telegram.channel_signature');
$signature_length = strlen($signature);
$text_length = strlen($text);
$max_length = ($type == 'text') ? TelegramApi::TEXT_LENGTH : TelegramApi::CAPTION_LENGTH... | [
"public",
"static",
"function",
"assignSignature",
"(",
"$",
"text",
",",
"$",
"type",
")",
"{",
"$",
"signature",
"=",
"\"\\n\"",
".",
"Config",
"::",
"get",
"(",
"'larasap.telegram.channel_signature'",
")",
";",
"$",
"signature_length",
"=",
"strlen",
"(",
... | Assign channel signature in the footer of message
@param $text
@param $text_type | [
"Assign",
"channel",
"signature",
"in",
"the",
"footer",
"of",
"message"
] | train | https://github.com/alihesari/laravel-social-auto-posting/blob/f6ed3c54eec8c88b2cf3f16d54daa9d6bbbd93b4/src/SendTo.php#L131-L142 |
nelmio/NelmioSecurityBundle | Session/CookieSessionHandler.php | CookieSessionHandler.destroy | public function destroy($sessionId)
{
$this->cookie = null;
if ($this->logger) {
$this->logger->debug(sprintf('CookieSessionHandler::destroy sessionId=%s', $sessionId));
}
return true;
} | php | public function destroy($sessionId)
{
$this->cookie = null;
if ($this->logger) {
$this->logger->debug(sprintf('CookieSessionHandler::destroy sessionId=%s', $sessionId));
}
return true;
} | [
"public",
"function",
"destroy",
"(",
"$",
"sessionId",
")",
"{",
"$",
"this",
"->",
"cookie",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"sprintf",
"(",
"'CookieSessionHandler::... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/Session/CookieSessionHandler.php#L120-L129 |
nelmio/NelmioSecurityBundle | Session/CookieSessionHandler.php | CookieSessionHandler.open | public function open($savePath, $sessionId)
{
if (!$this->request) {
if ($this->logger) {
$this->logger->crit('CookieSessionHandler::open - The Request object is missing');
}
throw new \RuntimeException('You cannot access the session without a Request obj... | php | public function open($savePath, $sessionId)
{
if (!$this->request) {
if ($this->logger) {
$this->logger->crit('CookieSessionHandler::open - The Request object is missing');
}
throw new \RuntimeException('You cannot access the session without a Request obj... | [
"public",
"function",
"open",
"(",
"$",
"savePath",
",",
"$",
"sessionId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"crit",
"(",
"'Cooki... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/Session/CookieSessionHandler.php#L142-L157 |
nelmio/NelmioSecurityBundle | Session/CookieSessionHandler.php | CookieSessionHandler.read | public function read($sessionId)
{
if (!$this->request) {
if ($this->logger) {
$this->logger->crit('CookieSessionHandler::read - The Request object is missing');
}
throw new \RuntimeException('You cannot access the session without a Request object set');
... | php | public function read($sessionId)
{
if (!$this->request) {
if ($this->logger) {
$this->logger->crit('CookieSessionHandler::read - The Request object is missing');
}
throw new \RuntimeException('You cannot access the session without a Request object set');
... | [
"public",
"function",
"read",
"(",
"$",
"sessionId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"crit",
"(",
"'CookieSessionHandler::read - The ... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/Session/CookieSessionHandler.php#L162-L194 |
nelmio/NelmioSecurityBundle | Session/CookieSessionHandler.php | CookieSessionHandler.write | public function write($sessionId, $sessionData)
{
if ($this->logger) {
$this->logger->debug(sprintf('CookieSessionHandler::write sessionId=%s', $sessionId));
}
$expire = $this->lifetime === 0 ? 0 : strtotime('now') + $this->lifetime;
$this->cookie = new Cookie(
... | php | public function write($sessionId, $sessionData)
{
if ($this->logger) {
$this->logger->debug(sprintf('CookieSessionHandler::write sessionId=%s', $sessionId));
}
$expire = $this->lifetime === 0 ? 0 : strtotime('now') + $this->lifetime;
$this->cookie = new Cookie(
... | [
"public",
"function",
"write",
"(",
"$",
"sessionId",
",",
"$",
"sessionData",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"sprintf",
"(",
"'CookieSessionHandler::write sessionId=%s'",
",",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/Session/CookieSessionHandler.php#L199-L220 |
nelmio/NelmioSecurityBundle | DependencyInjection/NelmioSecurityExtension.php | NelmioSecurityExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resource... | php | public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resource... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"processor",
"=",
"new",
"Processor",
"(",
")",
";",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=... | Parses the configuration.
@param array $configs
@param ContainerBuilder $container | [
"Parses",
"the",
"configuration",
"."
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/DependencyInjection/NelmioSecurityExtension.php#L31-L183 |
nelmio/NelmioSecurityBundle | ContentSecurityPolicy/ContentSecurityPolicyParser.php | ContentSecurityPolicyParser.parseSourceList | public function parseSourceList($sourceList)
{
if (!is_array($sourceList)) {
return $sourceList;
}
$sourceList = $this->quoteKeywords($sourceList);
return implode(' ', $sourceList);
} | php | public function parseSourceList($sourceList)
{
if (!is_array($sourceList)) {
return $sourceList;
}
$sourceList = $this->quoteKeywords($sourceList);
return implode(' ', $sourceList);
} | [
"public",
"function",
"parseSourceList",
"(",
"$",
"sourceList",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"sourceList",
")",
")",
"{",
"return",
"$",
"sourceList",
";",
"}",
"$",
"sourceList",
"=",
"$",
"this",
"->",
"quoteKeywords",
"(",
"$",
"... | @param array $sourceList
@return string | [
"@param",
"array",
"$sourceList"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/ContentSecurityPolicy/ContentSecurityPolicyParser.php#L32-L41 |
nelmio/NelmioSecurityBundle | ContentSecurityPolicy/ContentSecurityPolicyParser.php | ContentSecurityPolicyParser.quoteKeywords | protected function quoteKeywords(array $sourceList)
{
$keywords = $this->keywords;
return array_map(
function ($source) use ($keywords) {
if (in_array($source, $keywords, true)) {
return sprintf("'%s'", $source);
}
ret... | php | protected function quoteKeywords(array $sourceList)
{
$keywords = $this->keywords;
return array_map(
function ($source) use ($keywords) {
if (in_array($source, $keywords, true)) {
return sprintf("'%s'", $source);
}
ret... | [
"protected",
"function",
"quoteKeywords",
"(",
"array",
"$",
"sourceList",
")",
"{",
"$",
"keywords",
"=",
"$",
"this",
"->",
"keywords",
";",
"return",
"array_map",
"(",
"function",
"(",
"$",
"source",
")",
"use",
"(",
"$",
"keywords",
")",
"{",
"if",
... | @param array $sourceList
@return array | [
"@param",
"array",
"$sourceList"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/ContentSecurityPolicy/ContentSecurityPolicyParser.php#L48-L62 |
nelmio/NelmioSecurityBundle | UserAgent/UserAgentParser.php | UserAgentParser.getBrowser | public function getBrowser($userAgent)
{
$name = $this->parser->getUaFamily($userAgent);
switch (true) {
case 'chrome' === $name:
return self::BROWSER_CHROME;
case 'firefox' === $name:
return self::BROWSER_FIREFOX;
case 'opera' ===... | php | public function getBrowser($userAgent)
{
$name = $this->parser->getUaFamily($userAgent);
switch (true) {
case 'chrome' === $name:
return self::BROWSER_CHROME;
case 'firefox' === $name:
return self::BROWSER_FIREFOX;
case 'opera' ===... | [
"public",
"function",
"getBrowser",
"(",
"$",
"userAgent",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"parser",
"->",
"getUaFamily",
"(",
"$",
"userAgent",
")",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"'chrome'",
"===",
"$",
"name",
":",
"r... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/UserAgent/UserAgentParser.php#L28-L55 |
nelmio/NelmioSecurityBundle | ContentSecurityPolicy/PolicyManager.php | PolicyManager.getAvailableDirective | public function getAvailableDirective(Request $request)
{
if (null === $this->uaParser) {
return $this->getChromeDirectives();
}
switch ($this->uaParser->getBrowser($request->headers->get('user-agent'))) {
case UserAgentParserInterface::BROWSER_CHROME:
ca... | php | public function getAvailableDirective(Request $request)
{
if (null === $this->uaParser) {
return $this->getChromeDirectives();
}
switch ($this->uaParser->getBrowser($request->headers->get('user-agent'))) {
case UserAgentParserInterface::BROWSER_CHROME:
ca... | [
"public",
"function",
"getAvailableDirective",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"uaParser",
")",
"{",
"return",
"$",
"this",
"->",
"getChromeDirectives",
"(",
")",
";",
"}",
"switch",
"(",
"$",
"this"... | Returns the list of supported directives for the current Request
@param Request $request
@return array | [
"Returns",
"the",
"list",
"of",
"supported",
"directives",
"for",
"the",
"current",
"Request"
] | train | https://github.com/nelmio/NelmioSecurityBundle/blob/e2405b0a95879762fc1ed1a1b9466399a307c0ec/ContentSecurityPolicy/PolicyManager.php#L33-L49 |
jukylin/jaeger-php | src/Jaeger/Jaeger.php | Jaeger.startSpan | public function startSpan($operationName, $options = []){
if (is_array($options)) {
$options = SpanOptions::create($options);
}else{
throw new \Exception("options is not array");
}
$references = $options->getReferences();
$hasParent = false;
$pa... | php | public function startSpan($operationName, $options = []){
if (is_array($options)) {
$options = SpanOptions::create($options);
}else{
throw new \Exception("options is not array");
}
$references = $options->getReferences();
$hasParent = false;
$pa... | [
"public",
"function",
"startSpan",
"(",
"$",
"operationName",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"SpanOptions",
"::",
"create",
"(",
"$",
"options",
")",
";",
... | init span info
@param string $operationName
@param array $options
@return Span | [
"init",
"span",
"info"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Jaeger.php#L74-L120 |
jukylin/jaeger-php | src/Jaeger/Jaeger.php | Jaeger.inject | public function inject(SpanContext $spanContext, $format, &$carrier){
if($format == Formats\TEXT_MAP){
$this->propagator->inject($spanContext, $format, $carrier);
}else{
throw new \Exception("not support format");
}
} | php | public function inject(SpanContext $spanContext, $format, &$carrier){
if($format == Formats\TEXT_MAP){
$this->propagator->inject($spanContext, $format, $carrier);
}else{
throw new \Exception("not support format");
}
} | [
"public",
"function",
"inject",
"(",
"SpanContext",
"$",
"spanContext",
",",
"$",
"format",
",",
"&",
"$",
"carrier",
")",
"{",
"if",
"(",
"$",
"format",
"==",
"Formats",
"\\",
"TEXT_MAP",
")",
"{",
"$",
"this",
"->",
"propagator",
"->",
"inject",
"(",... | 注入
@param SpanContext $spanContext
@param string $format
@param $carrier | [
"注入"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Jaeger.php#L134-L140 |
jukylin/jaeger-php | src/Jaeger/Jaeger.php | Jaeger.extract | public function extract($format, $carrier){
if($format == Formats\TEXT_MAP){
return $this->propagator->extract($format, $carrier);
}else{
throw new \Exception("not support format");
}
} | php | public function extract($format, $carrier){
if($format == Formats\TEXT_MAP){
return $this->propagator->extract($format, $carrier);
}else{
throw new \Exception("not support format");
}
} | [
"public",
"function",
"extract",
"(",
"$",
"format",
",",
"$",
"carrier",
")",
"{",
"if",
"(",
"$",
"format",
"==",
"Formats",
"\\",
"TEXT_MAP",
")",
"{",
"return",
"$",
"this",
"->",
"propagator",
"->",
"extract",
"(",
"$",
"format",
",",
"$",
"carr... | 提取
@param string $format
@param $carrier | [
"提取"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Jaeger.php#L148-L154 |
jukylin/jaeger-php | src/Jaeger/Propagator/JaegerPropagator.php | JaegerPropagator.extract | public function extract($format, $carrier){
$spanContext = new SpanContext(0, 0, 0, null, 0);
foreach ($carrier as $k => $v){
$k = strtolower($k);
$v = urldecode($v);
if($k == Constants\Tracer_State_Header_Name){
list($traceId, $spanId, $parentId,$flag... | php | public function extract($format, $carrier){
$spanContext = new SpanContext(0, 0, 0, null, 0);
foreach ($carrier as $k => $v){
$k = strtolower($k);
$v = urldecode($v);
if($k == Constants\Tracer_State_Header_Name){
list($traceId, $spanId, $parentId,$flag... | [
"public",
"function",
"extract",
"(",
"$",
"format",
",",
"$",
"carrier",
")",
"{",
"$",
"spanContext",
"=",
"new",
"SpanContext",
"(",
"0",
",",
"0",
",",
"0",
",",
"null",
",",
"0",
")",
";",
"foreach",
"(",
"$",
"carrier",
"as",
"$",
"k",
"=>"... | 提取
@param string $format
@param $carrier | [
"提取"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Propagator/JaegerPropagator.php#L25-L61 |
jukylin/jaeger-php | src/Jaeger/Span.php | Span.log | public function log(array $fields = [], $timestamp = null){
$log['timestamp'] = $timestamp ? $timestamp : $this->microtimeToInt();
$log['fields'] = $fields;
$this->logs[] = $log;
} | php | public function log(array $fields = [], $timestamp = null){
$log['timestamp'] = $timestamp ? $timestamp : $this->microtimeToInt();
$log['fields'] = $fields;
$this->logs[] = $log;
} | [
"public",
"function",
"log",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"timestamp",
"=",
"null",
")",
"{",
"$",
"log",
"[",
"'timestamp'",
"]",
"=",
"$",
"timestamp",
"?",
"$",
"timestamp",
":",
"$",
"this",
"->",
"microtimeToInt",
"(",
... | Adds a log record to the span
@param array $fields
@param int|float|\DateTimeInterface $timestamp
@throws SpanAlreadyFinished if the span is already finished | [
"Adds",
"a",
"log",
"record",
"to",
"the",
"span"
] | train | https://github.com/jukylin/jaeger-php/blob/ec503218121d87db26dfd0aa350895fd732de38a/src/Jaeger/Span.php#L85-L89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.