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 |
|---|---|---|---|---|---|---|---|---|---|---|
top-think/think-swoole | src/Swoole.php | Swoole.setSwooleServerListeners | protected function setSwooleServerListeners()
{
foreach ($this->events as $event) {
$listener = Str::camel("on_$event");
$callback = method_exists($this, $listener) ? [$this, $listener] : function () use ($event) {
$this->container->event->trigger("swoole.$event", fun... | php | protected function setSwooleServerListeners()
{
foreach ($this->events as $event) {
$listener = Str::camel("on_$event");
$callback = method_exists($this, $listener) ? [$this, $listener] : function () use ($event) {
$this->container->event->trigger("swoole.$event", fun... | [
"protected",
"function",
"setSwooleServerListeners",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"events",
"as",
"$",
"event",
")",
"{",
"$",
"listener",
"=",
"Str",
"::",
"camel",
"(",
"\"on_$event\"",
")",
";",
"$",
"callback",
"=",
"method_exists"... | Set swoole server listeners. | [
"Set",
"swoole",
"server",
"listeners",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L108-L118 |
top-think/think-swoole | src/Swoole.php | Swoole.onStart | public function onStart()
{
$this->setProcessName('master process');
$this->createPidFile();
$this->container->event->trigger('swoole.start', func_get_args());
} | php | public function onStart()
{
$this->setProcessName('master process');
$this->createPidFile();
$this->container->event->trigger('swoole.start', func_get_args());
} | [
"public",
"function",
"onStart",
"(",
")",
"{",
"$",
"this",
"->",
"setProcessName",
"(",
"'master process'",
")",
";",
"$",
"this",
"->",
"createPidFile",
"(",
")",
";",
"$",
"this",
"->",
"container",
"->",
"event",
"->",
"trigger",
"(",
"'swoole.start'"... | "onStart" listener. | [
"onStart",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L123-L129 |
top-think/think-swoole | src/Swoole.php | Swoole.onWorkerStart | public function onWorkerStart($server)
{
if ($this->container->config->get('swoole.enable_coroutine', false)) {
Runtime::enableCoroutine(true);
}
$this->clearCache();
$this->container->event->trigger('swoole.workerStart', func_get_args());
// don't init app in ... | php | public function onWorkerStart($server)
{
if ($this->container->config->get('swoole.enable_coroutine', false)) {
Runtime::enableCoroutine(true);
}
$this->clearCache();
$this->container->event->trigger('swoole.workerStart', func_get_args());
// don't init app in ... | [
"public",
"function",
"onWorkerStart",
"(",
"$",
"server",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"->",
"config",
"->",
"get",
"(",
"'swoole.enable_coroutine'",
",",
"false",
")",
")",
"{",
"Runtime",
"::",
"enableCoroutine",
"(",
"true",
")"... | "onWorkerStart" listener.
@param \Swoole\Http\Server|mixed $server
@throws Exception | [
"onWorkerStart",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L149-L174 |
top-think/think-swoole | src/Swoole.php | Swoole.onRequest | public function onRequest($req, $res)
{
$this->app->event->trigger('swoole.request');
$this->resetOnRequest();
/** @var Sandbox $sandbox */
$sandbox = $this->app->make(Sandbox::class);
$request = $this->prepareRequest($req);
try {
$sandbox->setRequest($... | php | public function onRequest($req, $res)
{
$this->app->event->trigger('swoole.request');
$this->resetOnRequest();
/** @var Sandbox $sandbox */
$sandbox = $this->app->make(Sandbox::class);
$request = $this->prepareRequest($req);
try {
$sandbox->setRequest($... | [
"public",
"function",
"onRequest",
"(",
"$",
"req",
",",
"$",
"res",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"event",
"->",
"trigger",
"(",
"'swoole.request'",
")",
";",
"$",
"this",
"->",
"resetOnRequest",
"(",
")",
";",
"/** @var Sandbox $sandbox */",
... | "onRequest" listener.
@param Request $req
@param Response $res | [
"onRequest",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L257-L288 |
top-think/think-swoole | src/Swoole.php | Swoole.onTask | public function onTask($server, $taskId, $srcWorkerId, $data)
{
$this->container->event->trigger('swoole.task', func_get_args());
try {
// push websocket message
if ($this->isWebsocketPushPayload($data)) {
$this->pushMessage($server, $data['data']);
... | php | public function onTask($server, $taskId, $srcWorkerId, $data)
{
$this->container->event->trigger('swoole.task', func_get_args());
try {
// push websocket message
if ($this->isWebsocketPushPayload($data)) {
$this->pushMessage($server, $data['data']);
... | [
"public",
"function",
"onTask",
"(",
"$",
"server",
",",
"$",
"taskId",
",",
"$",
"srcWorkerId",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"container",
"->",
"event",
"->",
"trigger",
"(",
"'swoole.task'",
",",
"func_get_args",
"(",
")",
")",
";",... | Set onTask listener.
@param mixed $server
@param string|Task $taskId or $task
@param string $srcWorkerId
@param mixed $data | [
"Set",
"onTask",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L309-L322 |
top-think/think-swoole | src/Swoole.php | Swoole.bindSandbox | protected function bindSandbox()
{
$this->app->bind(Sandbox::class, function (App $app) {
return new Sandbox($app);
});
$this->app->bind('swoole.sandbox', Sandbox::class);
} | php | protected function bindSandbox()
{
$this->app->bind(Sandbox::class, function (App $app) {
return new Sandbox($app);
});
$this->app->bind('swoole.sandbox', Sandbox::class);
} | [
"protected",
"function",
"bindSandbox",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"Sandbox",
"::",
"class",
",",
"function",
"(",
"App",
"$",
"app",
")",
"{",
"return",
"new",
"Sandbox",
"(",
"$",
"app",
")",
";",
"}",
")",
";",
... | Bind sandbox to Laravel app container. | [
"Bind",
"sandbox",
"to",
"Laravel",
"app",
"container",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L350-L357 |
top-think/think-swoole | src/Swoole.php | Swoole.setProcessName | protected function setProcessName($process)
{
$serverName = 'swoole_http_server';
$appName = $this->container->config->get('app.name', 'ThinkPHP');
$name = sprintf('%s: %s for %s', $serverName, $process, $appName);
swoole_set_process_name($name);
} | php | protected function setProcessName($process)
{
$serverName = 'swoole_http_server';
$appName = $this->container->config->get('app.name', 'ThinkPHP');
$name = sprintf('%s: %s for %s', $serverName, $process, $appName);
swoole_set_process_name($name);
} | [
"protected",
"function",
"setProcessName",
"(",
"$",
"process",
")",
"{",
"$",
"serverName",
"=",
"'swoole_http_server'",
";",
"$",
"appName",
"=",
"$",
"this",
"->",
"container",
"->",
"config",
"->",
"get",
"(",
"'app.name'",
",",
"'ThinkPHP'",
")",
";",
... | Set process name.
@codeCoverageIgnore
@param $process | [
"Set",
"process",
"name",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L413-L422 |
top-think/think-swoole | src/Swoole.php | Swoole.logServerError | public function logServerError(Throwable $e)
{
/** @var Handle $handle */
$handle = $this->app->make(Handle::class);
$handle->renderForConsole(new Output(), $e);
$handle->report($e);
} | php | public function logServerError(Throwable $e)
{
/** @var Handle $handle */
$handle = $this->app->make(Handle::class);
$handle->renderForConsole(new Output(), $e);
$handle->report($e);
} | [
"public",
"function",
"logServerError",
"(",
"Throwable",
"$",
"e",
")",
"{",
"/** @var Handle $handle */",
"$",
"handle",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"Handle",
"::",
"class",
")",
";",
"$",
"handle",
"->",
"renderForConsole",
"(",
"n... | Log server error.
@param Throwable|Exception $e | [
"Log",
"server",
"error",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Swoole.php#L439-L447 |
top-think/think-swoole | src/Table.php | Table.add | public function add(string $name, SwooleTable $table)
{
$this->tables[$name] = $table;
return $this;
} | php | public function add(string $name, SwooleTable $table)
{
$this->tables[$name] = $table;
return $this;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"name",
",",
"SwooleTable",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"tables",
"[",
"$",
"name",
"]",
"=",
"$",
"table",
";",
"return",
"$",
"this",
";",
"}"
] | Add a swoole table to existing tables.
@param string $name
@param SwooleTable $table
@return Table | [
"Add",
"a",
"swoole",
"table",
"to",
"existing",
"tables",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/Table.php#L33-L38 |
top-think/think-swoole | src/websocket/socketio/Handler.php | Handler.onOpen | public function onOpen($fd, Request $request)
{
if (!$request->param('sid')) {
$payload = json_encode(
[
'sid' => base64_encode(uniqid()),
'upgrades' => [],
'pingInterval' => $this->config->get('swool... | php | public function onOpen($fd, Request $request)
{
if (!$request->param('sid')) {
$payload = json_encode(
[
'sid' => base64_encode(uniqid()),
'upgrades' => [],
'pingInterval' => $this->config->get('swool... | [
"public",
"function",
"onOpen",
"(",
"$",
"fd",
",",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"param",
"(",
"'sid'",
")",
")",
"{",
"$",
"payload",
"=",
"json_encode",
"(",
"[",
"'sid'",
"=>",
"base64_encode",
"(",
... | "onOpen" listener.
@param int $fd
@param Request $request
@return bool | [
"onOpen",
"listener",
"."
] | train | https://github.com/top-think/think-swoole/blob/97098551aa5ce832f4fdfdedbf0d1b512957979a/src/websocket/socketio/Handler.php#L35-L56 |
usmanhalalit/laracsv | src/Laracsv/Export.php | Export.build | public function build($collection, array $fields, $config = [])
{
$this->config = $config;
$csv = $this->writer;
$headers = [];
foreach ($fields as $key => $field) {
$headers[] = $field;
if (!is_numeric($key)) {
$fields[$key] = $key;
... | php | public function build($collection, array $fields, $config = [])
{
$this->config = $config;
$csv = $this->writer;
$headers = [];
foreach ($fields as $key => $field) {
$headers[] = $field;
if (!is_numeric($key)) {
$fields[$key] = $key;
... | [
"public",
"function",
"build",
"(",
"$",
"collection",
",",
"array",
"$",
"fields",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"$",
"csv",
"=",
"$",
"this",
"->",
"writer",
";",
"$",
"header... | Build the writer.
@param \Illuminate\Support\Collection $collection
@param array $fields
@param array $config
@return $this
@throws \League\Csv\CannotInsertRecord | [
"Build",
"the",
"writer",
"."
] | train | https://github.com/usmanhalalit/laracsv/blob/444aaa0af65cd70c303ebe8517ff00787b589378/src/Laracsv/Export.php#L61-L83 |
usmanhalalit/laracsv | src/Laracsv/Export.php | Export.download | public function download($filename = null)
{
$filename = $filename ?: date('Y-m-d_His') . '.csv';
$this->writer->output($filename);
} | php | public function download($filename = null)
{
$filename = $filename ?: date('Y-m-d_His') . '.csv';
$this->writer->output($filename);
} | [
"public",
"function",
"download",
"(",
"$",
"filename",
"=",
"null",
")",
"{",
"$",
"filename",
"=",
"$",
"filename",
"?",
":",
"date",
"(",
"'Y-m-d_His'",
")",
".",
"'.csv'",
";",
"$",
"this",
"->",
"writer",
"->",
"output",
"(",
"$",
"filename",
")... | Download the CSV file.
@param string|null $filename
@return void | [
"Download",
"the",
"CSV",
"file",
"."
] | train | https://github.com/usmanhalalit/laracsv/blob/444aaa0af65cd70c303ebe8517ff00787b589378/src/Laracsv/Export.php#L91-L95 |
usmanhalalit/laracsv | src/Laracsv/Export.php | Export.addCsvRows | private function addCsvRows(Collection $collection, array $fields, Writer $csv)
{
if ($this->isEloquentCollection) {
$collection->makeVisible($fields);
}
foreach ($collection as $model) {
$beforeEachCallback = $this->beforeEachCallback;
// Call hook
... | php | private function addCsvRows(Collection $collection, array $fields, Writer $csv)
{
if ($this->isEloquentCollection) {
$collection->makeVisible($fields);
}
foreach ($collection as $model) {
$beforeEachCallback = $this->beforeEachCallback;
// Call hook
... | [
"private",
"function",
"addCsvRows",
"(",
"Collection",
"$",
"collection",
",",
"array",
"$",
"fields",
",",
"Writer",
"$",
"csv",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEloquentCollection",
")",
"{",
"$",
"collection",
"->",
"makeVisible",
"(",
"$",
... | Add rows to the CSV.
@param \Illuminate\Support\Collection $collection
@param array $fields
@param \League\Csv\Writer $csv
@return void
@throws \League\Csv\CannotInsertRecord | [
"Add",
"rows",
"to",
"the",
"CSV",
"."
] | train | https://github.com/usmanhalalit/laracsv/blob/444aaa0af65cd70c303ebe8517ff00787b589378/src/Laracsv/Export.php#L138-L166 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.getAllGroupConversations | public function getAllGroupConversations($user)
{
$conversations = $this->query()->withCount('users')
->with([
'messages' => function ($query) {
return $query->latest();
}, 'users',
])->whereHas('users', function ($query) use ($user... | php | public function getAllGroupConversations($user)
{
$conversations = $this->query()->withCount('users')
->with([
'messages' => function ($query) {
return $query->latest();
}, 'users',
])->whereHas('users', function ($query) use ($user... | [
"public",
"function",
"getAllGroupConversations",
"(",
"$",
"user",
")",
"{",
"$",
"conversations",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"withCount",
"(",
"'users'",
")",
"->",
"with",
"(",
"[",
"'messages'",
"=>",
"function",
"(",
"$",
"quer... | @param $user
@return \Illuminate\Support\Collection | [
"@param",
"$user"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L44-L56 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.getGroupConversationMessageById | public function getGroupConversationMessageById($groupConversationId, $channel)
{
$conversation = $this->query()->with(['messages', 'messages.sender', 'messages.files', 'users', 'files'])->find($groupConversationId);
$collection = (object) null;
$collection->group_conversation = $conversati... | php | public function getGroupConversationMessageById($groupConversationId, $channel)
{
$conversation = $this->query()->with(['messages', 'messages.sender', 'messages.files', 'users', 'files'])->find($groupConversationId);
$collection = (object) null;
$collection->group_conversation = $conversati... | [
"public",
"function",
"getGroupConversationMessageById",
"(",
"$",
"groupConversationId",
",",
"$",
"channel",
")",
"{",
"$",
"conversation",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"with",
"(",
"[",
"'messages'",
",",
"'messages.sender'",
",",
"'mess... | @param $groupConversationId
@param $channel
@return object | [
"@param",
"$groupConversationId",
"@param",
"$channel"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L64-L76 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.createGroupConversation | public function createGroupConversation($groupName, array $users)
{
$group = $this->query()->create([
'name' => $groupName,
]);
if ($group) {
$group->users()->attach($users);
return true;
}
return false;
} | php | public function createGroupConversation($groupName, array $users)
{
$group = $this->query()->create([
'name' => $groupName,
]);
if ($group) {
$group->users()->attach($users);
return true;
}
return false;
} | [
"public",
"function",
"createGroupConversation",
"(",
"$",
"groupName",
",",
"array",
"$",
"users",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"create",
"(",
"[",
"'name'",
"=>",
"$",
"groupName",
",",
"]",
")",
";",
"if... | @param $groupName
@param array $users
@return bool | [
"@param",
"$groupName",
"@param",
"array",
"$users"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L84-L97 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.removeMembersFromGroupConversation | public function removeMembersFromGroupConversation($groupConversationId, array $users)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->detach($users);
return true;
}
return false;
} | php | public function removeMembersFromGroupConversation($groupConversationId, array $users)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->detach($users);
return true;
}
return false;
} | [
"public",
"function",
"removeMembersFromGroupConversation",
"(",
"$",
"groupConversationId",
",",
"array",
"$",
"users",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"if",
"(",
"$",
"group",
")",
"{",
"... | @param $groupConversationId
@param array $users
@return bool | [
"@param",
"$groupConversationId",
"@param",
"array",
"$users"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L105-L116 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.leaveFromGroupConversation | public function leaveFromGroupConversation($groupConversationId, $userId)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->detach($userId);
return true;
}
return false;
} | php | public function leaveFromGroupConversation($groupConversationId, $userId)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->detach($userId);
return true;
}
return false;
} | [
"public",
"function",
"leaveFromGroupConversation",
"(",
"$",
"groupConversationId",
",",
"$",
"userId",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"if",
"(",
"$",
"group",
")",
"{",
"$",
"group",
"... | @param $groupConversationId
@param $userId
@return bool | [
"@param",
"$groupConversationId",
"@param",
"$userId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L124-L135 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.addMembersToExistingGroupConversation | public function addMembersToExistingGroupConversation($groupConversationId, array $users)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->attach($users);
return true;
}
return false;
} | php | public function addMembersToExistingGroupConversation($groupConversationId, array $users)
{
$group = $this->find($groupConversationId);
if ($group) {
$group->users()->attach($users);
return true;
}
return false;
} | [
"public",
"function",
"addMembersToExistingGroupConversation",
"(",
"$",
"groupConversationId",
",",
"array",
"$",
"users",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"if",
"(",
"$",
"group",
")",
"{",
... | @param $groupConversationId
@param array $users
@return bool | [
"@param",
"$groupConversationId",
"@param",
"array",
"$users"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L143-L154 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.canJoinGroupConversation | public function canJoinGroupConversation($user, $groupConversationId)
{
$group = $this->find($groupConversationId);
if ($group) {
foreach ($group->users()->get() as $member) {
if ($member->id == $user->id) {
return true;
}
... | php | public function canJoinGroupConversation($user, $groupConversationId)
{
$group = $this->find($groupConversationId);
if ($group) {
foreach ($group->users()->get() as $member) {
if ($member->id == $user->id) {
return true;
}
... | [
"public",
"function",
"canJoinGroupConversation",
"(",
"$",
"user",
",",
"$",
"groupConversationId",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"if",
"(",
"$",
"group",
")",
"{",
"foreach",
"(",
"$"... | @param $user
@param $groupConversationId
@return bool | [
"@param",
"$user",
"@param",
"$groupConversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L162-L175 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.checkUserExist | public function checkUserExist($userId, $groupConversationId)
{
$group = $this->find($groupConversationId);
if ($group) {
foreach ($group->users()->get() as $member) {
if ($member->id == $userId) {
return true;
}
}
... | php | public function checkUserExist($userId, $groupConversationId)
{
$group = $this->find($groupConversationId);
if ($group) {
foreach ($group->users()->get() as $member) {
if ($member->id == $userId) {
return true;
}
}
... | [
"public",
"function",
"checkUserExist",
"(",
"$",
"userId",
",",
"$",
"groupConversationId",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"if",
"(",
"$",
"group",
")",
"{",
"foreach",
"(",
"$",
"gro... | @param $userId
@param $groupConversationId
@return bool | [
"@param",
"$userId",
"@param",
"$groupConversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L183-L196 |
PHPJunior/laravel-video-chat | src/Repositories/GroupConversation/GroupConversationRepository.php | GroupConversationRepository.sendMessage | private function sendMessage($groupConversationId, array $data)
{
$conversation = $this->find($groupConversationId);
$created = $conversation->messages()
->create([
'text' => $data['text'],
'user_id' => $data['user_id'],
]);
if ($c... | php | private function sendMessage($groupConversationId, array $data)
{
$conversation = $this->find($groupConversationId);
$created = $conversation->messages()
->create([
'text' => $data['text'],
'user_id' => $data['user_id'],
]);
if ($c... | [
"private",
"function",
"sendMessage",
"(",
"$",
"groupConversationId",
",",
"array",
"$",
"data",
")",
"{",
"$",
"conversation",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"groupConversationId",
")",
";",
"$",
"created",
"=",
"$",
"conversation",
"->",
"mes... | @param $groupConversationId
@param array $data
@return bool | [
"@param",
"$groupConversationId",
"@param",
"array",
"$data"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/GroupConversation/GroupConversationRepository.php#L220-L256 |
PHPJunior/laravel-video-chat | src/Services/Chat.php | Chat.getConversationMessageById | public function getConversationMessageById($conversationId)
{
if ($this->conversation->checkUserExist($this->userId, $conversationId)) {
$channel = $this->getChannelName($conversationId, 'chat_room');
return $this->conversation->getConversationMessageById($conversationId, $this->use... | php | public function getConversationMessageById($conversationId)
{
if ($this->conversation->checkUserExist($this->userId, $conversationId)) {
$channel = $this->getChannelName($conversationId, 'chat_room');
return $this->conversation->getConversationMessageById($conversationId, $this->use... | [
"public",
"function",
"getConversationMessageById",
"(",
"$",
"conversationId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"conversation",
"->",
"checkUserExist",
"(",
"$",
"this",
"->",
"userId",
",",
"$",
"conversationId",
")",
")",
"{",
"$",
"channel",
"=",
... | @param $conversationId
@return object | [
"@param",
"$conversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Services/Chat.php#L52-L61 |
PHPJunior/laravel-video-chat | src/Services/Chat.php | Chat.getGroupConversationMessageById | public function getGroupConversationMessageById($groupConversationId)
{
if ($this->group->checkUserExist($this->userId, $groupConversationId)) {
$channel = $this->getChannelName($groupConversationId, 'group_chat_room');
return $this->group->getGroupConversationMessageById($groupConv... | php | public function getGroupConversationMessageById($groupConversationId)
{
if ($this->group->checkUserExist($this->userId, $groupConversationId)) {
$channel = $this->getChannelName($groupConversationId, 'group_chat_room');
return $this->group->getGroupConversationMessageById($groupConv... | [
"public",
"function",
"getGroupConversationMessageById",
"(",
"$",
"groupConversationId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"group",
"->",
"checkUserExist",
"(",
"$",
"this",
"->",
"userId",
",",
"$",
"groupConversationId",
")",
")",
"{",
"$",
"channel",... | @param $groupConversationId
@return object | [
"@param",
"$groupConversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Services/Chat.php#L136-L145 |
PHPJunior/laravel-video-chat | src/LaravelVideoChatServiceProvider.php | LaravelVideoChatServiceProvider.boot | public function boot()
{
Relation::morphMap(config('laravel-video-chat.relation'));
$this->publishes([
$this->configPath() => config_path('laravel-video-chat.php'),
$this->componentsPath() => base_path('resources/assets/js/components/laravel-video-chat'),
]);
... | php | public function boot()
{
Relation::morphMap(config('laravel-video-chat.relation'));
$this->publishes([
$this->configPath() => config_path('laravel-video-chat.php'),
$this->componentsPath() => base_path('resources/assets/js/components/laravel-video-chat'),
]);
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"Relation",
"::",
"morphMap",
"(",
"config",
"(",
"'laravel-video-chat.relation'",
")",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"$",
"this",
"->",
"configPath",
"(",
")",
"=>",
"config_path",
"(",
... | Bootstrap the application services.
@return void | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/LaravelVideoChatServiceProvider.php#L22-L33 |
PHPJunior/laravel-video-chat | src/LaravelVideoChatServiceProvider.php | LaravelVideoChatServiceProvider.register | public function register()
{
$this->mergeConfigFrom($this->configPath(), 'laravel-video-chat');
$this->registerFacade();
$this->registerChat();
$this->registerUploadManager();
$this->registerAlias();
} | php | public function register()
{
$this->mergeConfigFrom($this->configPath(), 'laravel-video-chat');
$this->registerFacade();
$this->registerChat();
$this->registerUploadManager();
$this->registerAlias();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"this",
"->",
"configPath",
"(",
")",
",",
"'laravel-video-chat'",
")",
";",
"$",
"this",
"->",
"registerFacade",
"(",
")",
";",
"$",
"this",
"->",
"register... | Register the application services.
@return void | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/LaravelVideoChatServiceProvider.php#L40-L47 |
PHPJunior/laravel-video-chat | src/Services/UploadManager.php | UploadManager.fileDetails | public function fileDetails($path)
{
$path = '/'.ltrim($path, '/');
return [
'name' => basename($path),
'fullPath' => $path,
'webPath' => $this->fileWebPath($path),
'mimeType' => $this->fileMimeType($path),
'size' => $this->fileSi... | php | public function fileDetails($path)
{
$path = '/'.ltrim($path, '/');
return [
'name' => basename($path),
'fullPath' => $path,
'webPath' => $this->fileWebPath($path),
'mimeType' => $this->fileMimeType($path),
'size' => $this->fileSi... | [
"public",
"function",
"fileDetails",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"'/'",
".",
"ltrim",
"(",
"$",
"path",
",",
"'/'",
")",
";",
"return",
"[",
"'name'",
"=>",
"basename",
"(",
"$",
"path",
")",
",",
"'fullPath'",
"=>",
"$",
"path",
... | Return an array of file details for a file.
@param $path
@return array | [
"Return",
"an",
"array",
"of",
"file",
"details",
"for",
"a",
"file",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Services/UploadManager.php#L40-L51 |
PHPJunior/laravel-video-chat | src/Services/UploadManager.php | UploadManager.deleteFile | public function deleteFile($path)
{
$path = $this->cleanFolder($path);
if ($this->checkFileExists($path)) {
return $this->disk->delete($path);
}
return 'File does not exist.';
} | php | public function deleteFile($path)
{
$path = $this->cleanFolder($path);
if ($this->checkFileExists($path)) {
return $this->disk->delete($path);
}
return 'File does not exist.';
} | [
"public",
"function",
"deleteFile",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"cleanFolder",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"this",
"->",
"checkFileExists",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"this",... | Delete a file.
@param $path
@return string | [
"Delete",
"a",
"file",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Services/UploadManager.php#L60-L69 |
PHPJunior/laravel-video-chat | src/Services/UploadManager.php | UploadManager.saveFile | public function saveFile($path, $content)
{
$path = $this->cleanFolder($path);
return $this->disk->put($path, $content, 'public');
} | php | public function saveFile($path, $content)
{
$path = $this->cleanFolder($path);
return $this->disk->put($path, $content, 'public');
} | [
"public",
"function",
"saveFile",
"(",
"$",
"path",
",",
"$",
"content",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"cleanFolder",
"(",
"$",
"path",
")",
";",
"return",
"$",
"this",
"->",
"disk",
"->",
"put",
"(",
"$",
"path",
",",
"$",
"cont... | Save a file.
@param $path
@param $content
@return string | [
"Save",
"a",
"file",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Services/UploadManager.php#L79-L84 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.getAllConversations | public function getAllConversations($user)
{
$conversations = $this->query()->with(['messages' => function ($query) {
return $query->latest();
}, 'firstUser', 'secondUser'])->where('first_user_id', $user)->orWhere('second_user_id', $user)->get();
$threads = [];
foreach ... | php | public function getAllConversations($user)
{
$conversations = $this->query()->with(['messages' => function ($query) {
return $query->latest();
}, 'firstUser', 'secondUser'])->where('first_user_id', $user)->orWhere('second_user_id', $user)->get();
$threads = [];
foreach ... | [
"public",
"function",
"getAllConversations",
"(",
"$",
"user",
")",
"{",
"$",
"conversations",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"with",
"(",
"[",
"'messages'",
"=>",
"function",
"(",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",... | @param $user
@return \Illuminate\Support\Collection | [
"@param",
"$user"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L39-L55 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.canJoinConversation | public function canJoinConversation($user, $conversation)
{
$thread = $this->find($conversation);
if ($thread) {
if (($thread->first_user_id == $user->id) || ($thread->second_user_id == $user->id)) {
return true;
}
}
return false;
} | php | public function canJoinConversation($user, $conversation)
{
$thread = $this->find($conversation);
if ($thread) {
if (($thread->first_user_id == $user->id) || ($thread->second_user_id == $user->id)) {
return true;
}
}
return false;
} | [
"public",
"function",
"canJoinConversation",
"(",
"$",
"user",
",",
"$",
"conversation",
")",
"{",
"$",
"thread",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"conversation",
")",
";",
"if",
"(",
"$",
"thread",
")",
"{",
"if",
"(",
"(",
"$",
"thread",
... | @param $user
@param $conversation
@return bool | [
"@param",
"$user",
"@param",
"$conversation"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L63-L74 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.getConversationMessageById | public function getConversationMessageById($conversationId, $userID, $channel)
{
$conversation = $this->query()->with(['messages', 'messages.sender', 'messages.files', 'firstUser', 'secondUser', 'files'])->find($conversationId);
$collection = (object) null;
$collection->conversationId = $co... | php | public function getConversationMessageById($conversationId, $userID, $channel)
{
$conversation = $this->query()->with(['messages', 'messages.sender', 'messages.files', 'firstUser', 'secondUser', 'files'])->find($conversationId);
$collection = (object) null;
$collection->conversationId = $co... | [
"public",
"function",
"getConversationMessageById",
"(",
"$",
"conversationId",
",",
"$",
"userID",
",",
"$",
"channel",
")",
"{",
"$",
"conversation",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"with",
"(",
"[",
"'messages'",
",",
"'messages.sender'",... | @param $conversationId
@param $userID
@param $channel
@return object | [
"@param",
"$conversationId",
"@param",
"$userID",
"@param",
"$channel"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L83-L95 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.startConversationWith | public function startConversationWith($firstUserId, $secondUserId)
{
$created = $this->query()->create([
'first_user_id' => $firstUserId,
'second_user_id' => $secondUserId,
]);
if ($created) {
return true;
}
return false;
} | php | public function startConversationWith($firstUserId, $secondUserId)
{
$created = $this->query()->create([
'first_user_id' => $firstUserId,
'second_user_id' => $secondUserId,
]);
if ($created) {
return true;
}
return false;
} | [
"public",
"function",
"startConversationWith",
"(",
"$",
"firstUserId",
",",
"$",
"secondUserId",
")",
"{",
"$",
"created",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"create",
"(",
"[",
"'first_user_id'",
"=>",
"$",
"firstUserId",
",",
"'second_user_i... | @param $firstUserId
@param $secondUserId
@return bool | [
"@param",
"$firstUserId",
"@param",
"$secondUserId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L123-L135 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.acceptMessageRequest | public function acceptMessageRequest($userId, $conversationId)
{
if ($this->checkUserExist($userId, $conversationId)) {
$conversation = $this->find($conversationId);
$conversation->is_accepted = true;
$conversation->save();
return true;
}
ret... | php | public function acceptMessageRequest($userId, $conversationId)
{
if ($this->checkUserExist($userId, $conversationId)) {
$conversation = $this->find($conversationId);
$conversation->is_accepted = true;
$conversation->save();
return true;
}
ret... | [
"public",
"function",
"acceptMessageRequest",
"(",
"$",
"userId",
",",
"$",
"conversationId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkUserExist",
"(",
"$",
"userId",
",",
"$",
"conversationId",
")",
")",
"{",
"$",
"conversation",
"=",
"$",
"this",
... | @param $userId
@param $conversationId
@return bool | [
"@param",
"$userId",
"@param",
"$conversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L143-L154 |
PHPJunior/laravel-video-chat | src/Repositories/Conversation/ConversationRepository.php | ConversationRepository.checkUserExist | public function checkUserExist($userId, $conversationId)
{
$thread = $this->find($conversationId);
if ($thread) {
if (($thread->first_user_id == $userId) || ($thread->second_user_id == $userId)) {
return true;
}
}
return false;
} | php | public function checkUserExist($userId, $conversationId)
{
$thread = $this->find($conversationId);
if ($thread) {
if (($thread->first_user_id == $userId) || ($thread->second_user_id == $userId)) {
return true;
}
}
return false;
} | [
"public",
"function",
"checkUserExist",
"(",
"$",
"userId",
",",
"$",
"conversationId",
")",
"{",
"$",
"thread",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"conversationId",
")",
";",
"if",
"(",
"$",
"thread",
")",
"{",
"if",
"(",
"(",
"$",
"thread",
... | @param $userId
@param $conversationId
@return bool | [
"@param",
"$userId",
"@param",
"$conversationId"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/Conversation/ConversationRepository.php#L162-L173 |
PHPJunior/laravel-video-chat | src/Repositories/BaseRepository.php | BaseRepository.update | public function update(Model $model, array $input)
{
$updated = $model->update($input);
if ($updated) {
app('cache')->flush();
}
return $updated;
} | php | public function update(Model $model, array $input)
{
$updated = $model->update($input);
if ($updated) {
app('cache')->flush();
}
return $updated;
} | [
"public",
"function",
"update",
"(",
"Model",
"$",
"model",
",",
"array",
"$",
"input",
")",
"{",
"$",
"updated",
"=",
"$",
"model",
"->",
"update",
"(",
"$",
"input",
")",
";",
"if",
"(",
"$",
"updated",
")",
"{",
"app",
"(",
"'cache'",
")",
"->... | @param Model $model
@param array $input
@return bool | [
"@param",
"Model",
"$model",
"@param",
"array",
"$input"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/BaseRepository.php#L49-L58 |
PHPJunior/laravel-video-chat | src/Repositories/BaseRepository.php | BaseRepository.delete | public function delete(Model $model)
{
$deleted = $model->delete();
if ($deleted) {
app('cache')->flush();
}
return $deleted;
} | php | public function delete(Model $model)
{
$deleted = $model->delete();
if ($deleted) {
app('cache')->flush();
}
return $deleted;
} | [
"public",
"function",
"delete",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"deleted",
"=",
"$",
"model",
"->",
"delete",
"(",
")",
";",
"if",
"(",
"$",
"deleted",
")",
"{",
"app",
"(",
"'cache'",
")",
"->",
"flush",
"(",
")",
";",
"}",
"return",
... | @param Model $model
@return bool|null | [
"@param",
"Model",
"$model"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/BaseRepository.php#L65-L74 |
PHPJunior/laravel-video-chat | src/Repositories/BaseRepository.php | BaseRepository.save | public function save(Model $model)
{
$saved = $model->save();
if ($saved) {
app('cache')->flush();
}
return $saved;
} | php | public function save(Model $model)
{
$saved = $model->save();
if ($saved) {
app('cache')->flush();
}
return $saved;
} | [
"public",
"function",
"save",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"saved",
"=",
"$",
"model",
"->",
"save",
"(",
")",
";",
"if",
"(",
"$",
"saved",
")",
"{",
"app",
"(",
"'cache'",
")",
"->",
"flush",
"(",
")",
";",
"}",
"return",
"$",
... | @param Model $model
@return bool | [
"@param",
"Model",
"$model"
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/src/Repositories/BaseRepository.php#L81-L90 |
PHPJunior/laravel-video-chat | database/migrations/2017_10_21_172616_create_group_users_table.php | CreateGroupUsersTable.up | public function up()
{
Schema::create(config('laravel-video-chat.table.group_users_table'), function (Blueprint $table) {
$table->unsignedInteger('group_conversation_id');
$table->unsignedInteger('user_id');
});
} | php | public function up()
{
Schema::create(config('laravel-video-chat.table.group_users_table'), function (Blueprint $table) {
$table->unsignedInteger('group_conversation_id');
$table->unsignedInteger('user_id');
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"config",
"(",
"'laravel-video-chat.table.group_users_table'",
")",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"unsignedInteger",
"(",
"'group_conversat... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/database/migrations/2017_10_21_172616_create_group_users_table.php#L14-L20 |
PHPJunior/laravel-video-chat | database/migrations/2017_10_25_165610_add_is_accepted_column_to_conversation_table.php | AddIsAcceptedColumnToConversationTable.up | public function up()
{
Schema::table(config('laravel-video-chat.table.conversations_table'), function (Blueprint $table) {
$table->boolean('is_accepted')->default(false)->after('second_user_id');
});
} | php | public function up()
{
Schema::table(config('laravel-video-chat.table.conversations_table'), function (Blueprint $table) {
$table->boolean('is_accepted')->default(false)->after('second_user_id');
});
} | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"table",
"(",
"config",
"(",
"'laravel-video-chat.table.conversations_table'",
")",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"boolean",
"(",
"'is_accepted'",
")",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/PHPJunior/laravel-video-chat/blob/39fd18fdcc6a7247d05645165fe04c755819e5f6/database/migrations/2017_10_25_165610_add_is_accepted_column_to_conversation_table.php#L14-L19 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getLoginUrl | public function getLoginUrl($scopes = array('basic'))
{
if (is_array($scopes) && count(array_intersect($scopes, $this->_scopes)) === count($scopes)) {
return self::API_OAUTH_URL . '?client_id=' . $this->getApiKey() . '&redirect_uri=' . urlencode($this->getApiCallback()) . '&scope=' . implode('+'... | php | public function getLoginUrl($scopes = array('basic'))
{
if (is_array($scopes) && count(array_intersect($scopes, $this->_scopes)) === count($scopes)) {
return self::API_OAUTH_URL . '?client_id=' . $this->getApiKey() . '&redirect_uri=' . urlencode($this->getApiCallback()) . '&scope=' . implode('+'... | [
"public",
"function",
"getLoginUrl",
"(",
"$",
"scopes",
"=",
"array",
"(",
"'basic'",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"scopes",
")",
"&&",
"count",
"(",
"array_intersect",
"(",
"$",
"scopes",
",",
"$",
"this",
"->",
"_scopes",
")",
"... | Generates the OAuth login URL.
@param string[] $scopes Requesting additional permissions
@return string Instagram OAuth login URL
@throws \MetzWeb\Instagram\InstagramException | [
"Generates",
"the",
"OAuth",
"login",
"URL",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L123-L131 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.searchUser | public function searchUser($name, $limit = 0)
{
$params = array();
$params['q'] = $name;
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/search', false, $params);
} | php | public function searchUser($name, $limit = 0)
{
$params = array();
$params['q'] = $name;
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/search', false, $params);
} | [
"public",
"function",
"searchUser",
"(",
"$",
"name",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"params",
"[",
"'q'",
"]",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
... | Search for a user.
@param string $name Instagram username
@param int $limit Limit of returned results
@return mixed | [
"Search",
"for",
"a",
"user",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L141-L151 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUser | public function getUser($id = 0)
{
$auth = false;
if ($id === 0 && isset($this->_accesstoken)) {
$id = 'self';
$auth = true;
}
return $this->_makeCall('users/' . $id, $auth);
} | php | public function getUser($id = 0)
{
$auth = false;
if ($id === 0 && isset($this->_accesstoken)) {
$id = 'self';
$auth = true;
}
return $this->_makeCall('users/' . $id, $auth);
} | [
"public",
"function",
"getUser",
"(",
"$",
"id",
"=",
"0",
")",
"{",
"$",
"auth",
"=",
"false",
";",
"if",
"(",
"$",
"id",
"===",
"0",
"&&",
"isset",
"(",
"$",
"this",
"->",
"_accesstoken",
")",
")",
"{",
"$",
"id",
"=",
"'self'",
";",
"$",
"... | Get user info.
@param int $id Instagram user ID
@return mixed | [
"Get",
"user",
"info",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L160-L170 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUserFeed | public function getUserFeed($limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/self/feed', true, $params);
} | php | public function getUserFeed($limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/self/feed', true, $params);
} | [
"public",
"function",
"getUserFeed",
"(",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$",
"limit",
";",
"}",
"return",
"$",... | Get user activity feed.
@param int $limit Limit of returned results
@return mixed | [
"Get",
"user",
"activity",
"feed",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L179-L187 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUserMedia | public function getUserMedia($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/media/recent', strlen($this->getAccessToken()), $params);
} | php | public function getUserMedia($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/media/recent', strlen($this->getAccessToken()), $params);
} | [
"public",
"function",
"getUserMedia",
"(",
"$",
"id",
"=",
"'self'",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$",
... | Get user recent media.
@param int|string $id Instagram user ID
@param int $limit Limit of returned results
@return mixed | [
"Get",
"user",
"recent",
"media",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L197-L206 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUserLikes | public function getUserLikes($limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/self/media/liked', true, $params);
} | php | public function getUserLikes($limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/self/media/liked', true, $params);
} | [
"public",
"function",
"getUserLikes",
"(",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$",
"limit",
";",
"}",
"return",
"$"... | Get the liked photos of a user.
@param int $limit Limit of returned results
@return mixed | [
"Get",
"the",
"liked",
"photos",
"of",
"a",
"user",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L215-L224 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUserFollows | public function getUserFollows($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/follows', true, $params);
} | php | public function getUserFollows($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/follows', true, $params);
} | [
"public",
"function",
"getUserFollows",
"(",
"$",
"id",
"=",
"'self'",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$",... | Get the list of users this user follows
@param int|string $id Instagram user ID.
@param int $limit Limit of returned results
@return mixed | [
"Get",
"the",
"list",
"of",
"users",
"this",
"user",
"follows"
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L234-L243 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getUserFollower | public function getUserFollower($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/followed-by', true, $params);
} | php | public function getUserFollower($id = 'self', $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('users/' . $id . '/followed-by', true, $params);
} | [
"public",
"function",
"getUserFollower",
"(",
"$",
"id",
"=",
"'self'",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$"... | Get the list of users this user is followed by.
@param int|string $id Instagram user ID
@param int $limit Limit of returned results
@return mixed | [
"Get",
"the",
"list",
"of",
"users",
"this",
"user",
"is",
"followed",
"by",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L253-L262 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.searchMedia | public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = null, $maxTimestamp = null)
{
return $this->_makeCall('media/search', false, array(
'lat' => $lat,
'lng' => $lng,
'distance' => $distance,
'min_timestamp' => $minTimestamp,
'... | php | public function searchMedia($lat, $lng, $distance = 1000, $minTimestamp = null, $maxTimestamp = null)
{
return $this->_makeCall('media/search', false, array(
'lat' => $lat,
'lng' => $lng,
'distance' => $distance,
'min_timestamp' => $minTimestamp,
'... | [
"public",
"function",
"searchMedia",
"(",
"$",
"lat",
",",
"$",
"lng",
",",
"$",
"distance",
"=",
"1000",
",",
"$",
"minTimestamp",
"=",
"null",
",",
"$",
"maxTimestamp",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_makeCall",
"(",
"'media/sea... | Search media by its location.
@param float $lat Latitude of the center search coordinate
@param float $lng Longitude of the center search coordinate
@param int $distance Distance in metres (default is 1km (distance=1000), max. is 5km)
@param long $minTimestamp Media taken later than this timestamp (default: 5 days ago... | [
"Search",
"media",
"by",
"its",
"location",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L316-L325 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getTagMedia | public function getTagMedia($name, $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('tags/' . $name . '/media/recent', false, $params);
} | php | public function getTagMedia($name, $limit = 0)
{
$params = array();
if ($limit > 0) {
$params['count'] = $limit;
}
return $this->_makeCall('tags/' . $name . '/media/recent', false, $params);
} | [
"public",
"function",
"getTagMedia",
"(",
"$",
"name",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"limit",
">",
"0",
")",
"{",
"$",
"params",
"[",
"'count'",
"]",
"=",
"$",
"limit",
";",
... | Get a recently tagged media.
@param string $name Valid tag name
@param int $limit Limit of returned results
@return mixed | [
"Get",
"a",
"recently",
"tagged",
"media",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L381-L390 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.searchLocation | public function searchLocation($lat, $lng, $distance = 1000)
{
return $this->_makeCall('locations/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance));
} | php | public function searchLocation($lat, $lng, $distance = 1000)
{
return $this->_makeCall('locations/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance));
} | [
"public",
"function",
"searchLocation",
"(",
"$",
"lat",
",",
"$",
"lng",
",",
"$",
"distance",
"=",
"1000",
")",
"{",
"return",
"$",
"this",
"->",
"_makeCall",
"(",
"'locations/search'",
",",
"false",
",",
"array",
"(",
"'lat'",
"=>",
"$",
"lat",
",",... | Get recent media from a given location.
@param float $lat Latitude of the center search coordinate
@param float $lng Longitude of the center search coordinate
@param int $distance Distance in meter (max. distance: 5km = 5000)
@return mixed | [
"Get",
"recent",
"media",
"from",
"a",
"given",
"location",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L499-L502 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.pagination | public function pagination($obj, $limit = 0)
{
if (is_object($obj) && !is_null($obj->pagination)) {
if (!isset($obj->pagination->next_url)) {
return;
}
$apiCall = explode('?', $obj->pagination->next_url);
if (count($apiCall) < 2) {
... | php | public function pagination($obj, $limit = 0)
{
if (is_object($obj) && !is_null($obj->pagination)) {
if (!isset($obj->pagination->next_url)) {
return;
}
$apiCall = explode('?', $obj->pagination->next_url);
if (count($apiCall) < 2) {
... | [
"public",
"function",
"pagination",
"(",
"$",
"obj",
",",
"$",
"limit",
"=",
"0",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"obj",
")",
"&&",
"!",
"is_null",
"(",
"$",
"obj",
"->",
"pagination",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$... | Pagination feature.
@param object $obj Instagram object returned by a method
@param int $limit Limit of returned results
@return mixed
@throws \MetzWeb\Instagram\InstagramException | [
"Pagination",
"feature",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L514-L539 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.getOAuthToken | public function getOAuthToken($code, $token = false)
{
$apiData = array(
'grant_type' => 'authorization_code',
'client_id' => $this->getApiKey(),
'client_secret' => $this->getApiSecret(),
'redirect_uri' => $this->getApiCallback(),
'code' => $code
... | php | public function getOAuthToken($code, $token = false)
{
$apiData = array(
'grant_type' => 'authorization_code',
'client_id' => $this->getApiKey(),
'client_secret' => $this->getApiSecret(),
'redirect_uri' => $this->getApiCallback(),
'code' => $code
... | [
"public",
"function",
"getOAuthToken",
"(",
"$",
"code",
",",
"$",
"token",
"=",
"false",
")",
"{",
"$",
"apiData",
"=",
"array",
"(",
"'grant_type'",
"=>",
"'authorization_code'",
",",
"'client_id'",
"=>",
"$",
"this",
"->",
"getApiKey",
"(",
")",
",",
... | Get the OAuth data of a user by the returned callback code.
@param string $code OAuth2 code variable (after a successful login)
@param bool $token If it's true, only the access token will be returned
@return mixed | [
"Get",
"the",
"OAuth",
"data",
"of",
"a",
"user",
"by",
"the",
"returned",
"callback",
"code",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L549-L562 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram._makeCall | protected function _makeCall($function, $auth = false, $params = null, $method = 'GET')
{
if (!$auth) {
// if the call doesn't requires authentication
$authMethod = '?client_id=' . $this->getApiKey();
} else {
// if the call needs an authenticated user
... | php | protected function _makeCall($function, $auth = false, $params = null, $method = 'GET')
{
if (!$auth) {
// if the call doesn't requires authentication
$authMethod = '?client_id=' . $this->getApiKey();
} else {
// if the call needs an authenticated user
... | [
"protected",
"function",
"_makeCall",
"(",
"$",
"function",
",",
"$",
"auth",
"=",
"false",
",",
"$",
"params",
"=",
"null",
",",
"$",
"method",
"=",
"'GET'",
")",
"{",
"if",
"(",
"!",
"$",
"auth",
")",
"{",
"// if the call doesn't requires authentication"... | The call operator.
@param string $function API resource path
@param bool $auth Whether the function requires an access token
@param array $params Additional request parameters
@param string $method Request type GET|POST
@return mixed
@throws \MetzWeb\Instagram\InstagramException | [
"The",
"call",
"operator",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L576-L642 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram._makeOAuthCall | private function _makeOAuthCall($apiData)
{
$apiHost = self::API_OAUTH_TOKEN_URL;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiHost);
curl_setopt($ch, CURLOPT_POST, count($apiData));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setop... | php | private function _makeOAuthCall($apiData)
{
$apiHost = self::API_OAUTH_TOKEN_URL;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiHost);
curl_setopt($ch, CURLOPT_POST, count($apiData));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setop... | [
"private",
"function",
"_makeOAuthCall",
"(",
"$",
"apiData",
")",
"{",
"$",
"apiHost",
"=",
"self",
"::",
"API_OAUTH_TOKEN_URL",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"apiHost",
")"... | The OAuth call operator.
@param array $apiData The post API data
@return mixed
@throws \MetzWeb\Instagram\InstagramException | [
"The",
"OAuth",
"call",
"operator",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L653-L674 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram._signHeader | private function _signHeader($endpoint, $authMethod, $params)
{
if (!is_array($params)) {
$params = array();
}
if ($authMethod) {
list($key, $value) = explode('=', substr($authMethod, 1), 2);
$params[$key] = $value;
}
$baseString = '/' . $e... | php | private function _signHeader($endpoint, $authMethod, $params)
{
if (!is_array($params)) {
$params = array();
}
if ($authMethod) {
list($key, $value) = explode('=', substr($authMethod, 1), 2);
$params[$key] = $value;
}
$baseString = '/' . $e... | [
"private",
"function",
"_signHeader",
"(",
"$",
"endpoint",
",",
"$",
"authMethod",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"}",
"if",
"(",
"$",
"aut... | Sign header by using endpoint, parameters and the API secret.
@param string
@param string
@param array
@return string The signature | [
"Sign",
"header",
"by",
"using",
"endpoint",
"parameters",
"and",
"the",
"API",
"secret",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L685-L702 |
cosenary/Instagram-PHP-API | src/Instagram.php | Instagram.processHeaders | private function processHeaders($headerContent)
{
$headers = array();
foreach (explode("\r\n", $headerContent) as $i => $line) {
if ($i === 0) {
$headers['http_code'] = $line;
continue;
}
list($key, $value) = explode(':', $line);
... | php | private function processHeaders($headerContent)
{
$headers = array();
foreach (explode("\r\n", $headerContent) as $i => $line) {
if ($i === 0) {
$headers['http_code'] = $line;
continue;
}
list($key, $value) = explode(':', $line);
... | [
"private",
"function",
"processHeaders",
"(",
"$",
"headerContent",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"\"\\r\\n\"",
",",
"$",
"headerContent",
")",
"as",
"$",
"i",
"=>",
"$",
"line",
")",
"{",
"if",
... | Read and process response header content.
@param array
@return array | [
"Read",
"and",
"process",
"response",
"header",
"content",
"."
] | train | https://github.com/cosenary/Instagram-PHP-API/blob/6ba37197600bccd4389c7bad8dffe3379a5afc01/src/Instagram.php#L711-L726 |
GrahamCampbell/Laravel-Markdown | src/Engines/PhpMarkdownEngine.php | PhpMarkdownEngine.get | public function get($path, array $data = [])
{
$contents = parent::get($path, $data);
return $this->markdown->convertToHtml($contents);
} | php | public function get($path, array $data = [])
{
$contents = parent::get($path, $data);
return $this->markdown->convertToHtml($contents);
} | [
"public",
"function",
"get",
"(",
"$",
"path",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"contents",
"=",
"parent",
"::",
"get",
"(",
"$",
"path",
",",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"markdown",
"->",
"convertT... | Get the evaluated contents of the view.
@param string $path
@param array $data
@return string | [
"Get",
"the",
"evaluated",
"contents",
"of",
"the",
"view",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/Engines/PhpMarkdownEngine.php#L53-L58 |
GrahamCampbell/Laravel-Markdown | src/Compilers/MarkdownCompiler.php | MarkdownCompiler.compile | public function compile($path)
{
$contents = $this->markdown->convertToHtml($this->files->get($path));
$this->files->put($this->getCompiledPath($path), $contents);
} | php | public function compile($path)
{
$contents = $this->markdown->convertToHtml($this->files->get($path));
$this->files->put($this->getCompiledPath($path), $contents);
} | [
"public",
"function",
"compile",
"(",
"$",
"path",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"markdown",
"->",
"convertToHtml",
"(",
"$",
"this",
"->",
"files",
"->",
"get",
"(",
"$",
"path",
")",
")",
";",
"$",
"this",
"->",
"files",
"->"... | Compile the view at the given path.
@param string $path
@return void | [
"Compile",
"the",
"view",
"at",
"the",
"given",
"path",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/Compilers/MarkdownCompiler.php#L58-L63 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.boot | public function boot()
{
$this->setupConfig();
if ($this->app->config->get('markdown.views')) {
$this->enableMarkdownCompiler();
$this->enablePhpMarkdownEngine();
$this->enableBladeMarkdownEngine();
$this->enableBladeDirective();
}
} | php | public function boot()
{
$this->setupConfig();
if ($this->app->config->get('markdown.views')) {
$this->enableMarkdownCompiler();
$this->enablePhpMarkdownEngine();
$this->enableBladeMarkdownEngine();
$this->enableBladeDirective();
}
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"setupConfig",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"config",
"->",
"get",
"(",
"'markdown.views'",
")",
")",
"{",
"$",
"this",
"->",
"enableMarkdownCompiler",
"(",
... | Boot the service provider.
@return void | [
"Boot",
"the",
"service",
"provider",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L42-L52 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.enablePhpMarkdownEngine | protected function enablePhpMarkdownEngine()
{
$app = $this->app;
$app->view->getEngineResolver()->register('phpmd', function () use ($app) {
$markdown = $app['markdown'];
return new PhpMarkdownEngine($markdown);
});
$app->view->addExtension('md.php', 'phpm... | php | protected function enablePhpMarkdownEngine()
{
$app = $this->app;
$app->view->getEngineResolver()->register('phpmd', function () use ($app) {
$markdown = $app['markdown'];
return new PhpMarkdownEngine($markdown);
});
$app->view->addExtension('md.php', 'phpm... | [
"protected",
"function",
"enablePhpMarkdownEngine",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"app",
"->",
"view",
"->",
"getEngineResolver",
"(",
")",
"->",
"register",
"(",
"'phpmd'",
",",
"function",
"(",
")",
"use",
"(",
"... | Enable the php markdown engine.
@return void | [
"Enable",
"the",
"php",
"markdown",
"engine",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L95-L106 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.enableBladeMarkdownEngine | protected function enableBladeMarkdownEngine()
{
$app = $this->app;
$app->view->getEngineResolver()->register('blademd', function () use ($app) {
$compiler = $app['blade.compiler'];
$markdown = $app['markdown'];
return new BladeMarkdownEngine($compiler, $markdow... | php | protected function enableBladeMarkdownEngine()
{
$app = $this->app;
$app->view->getEngineResolver()->register('blademd', function () use ($app) {
$compiler = $app['blade.compiler'];
$markdown = $app['markdown'];
return new BladeMarkdownEngine($compiler, $markdow... | [
"protected",
"function",
"enableBladeMarkdownEngine",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"app",
"->",
"view",
"->",
"getEngineResolver",
"(",
")",
"->",
"register",
"(",
"'blademd'",
",",
"function",
"(",
")",
"use",
"(",... | Enable the blade markdown engine.
@return void | [
"Enable",
"the",
"blade",
"markdown",
"engine",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L113-L125 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.registerEnvironment | protected function registerEnvironment()
{
$this->app->singleton('markdown.environment', function (Container $app) {
$environment = Environment::createCommonMarkEnvironment();
$config = $app->config->get('markdown');
$environment->mergeConfig(array_except($config, ['ext... | php | protected function registerEnvironment()
{
$this->app->singleton('markdown.environment', function (Container $app) {
$environment = Environment::createCommonMarkEnvironment();
$config = $app->config->get('markdown');
$environment->mergeConfig(array_except($config, ['ext... | [
"protected",
"function",
"registerEnvironment",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'markdown.environment'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"environment",
"=",
"Environment",
"::",
"createCommonMarkEnv... | Register the environment class.
@return void | [
"Register",
"the",
"environment",
"class",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L161-L178 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.registerMarkdown | protected function registerMarkdown()
{
$this->app->singleton('markdown', function (Container $app) {
$environment = $app['markdown.environment'];
$docParser = new DocParser($environment);
$htmlRenderer = new HtmlRenderer($environment);
return new Converter($... | php | protected function registerMarkdown()
{
$this->app->singleton('markdown', function (Container $app) {
$environment = $app['markdown.environment'];
$docParser = new DocParser($environment);
$htmlRenderer = new HtmlRenderer($environment);
return new Converter($... | [
"protected",
"function",
"registerMarkdown",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'markdown'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"environment",
"=",
"$",
"app",
"[",
"'markdown.environment'",
"]",
";... | Register the markdowm class.
@return void | [
"Register",
"the",
"markdowm",
"class",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L185-L197 |
GrahamCampbell/Laravel-Markdown | src/MarkdownServiceProvider.php | MarkdownServiceProvider.registerCompiler | protected function registerCompiler()
{
$this->app->singleton('markdown.compiler', function (Container $app) {
$markdown = $app['markdown'];
$files = $app['files'];
$storagePath = $app->config->get('view.compiled');
return new MarkdownCompiler($markdown, $fil... | php | protected function registerCompiler()
{
$this->app->singleton('markdown.compiler', function (Container $app) {
$markdown = $app['markdown'];
$files = $app['files'];
$storagePath = $app->config->get('view.compiled');
return new MarkdownCompiler($markdown, $fil... | [
"protected",
"function",
"registerCompiler",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'markdown.compiler'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"markdown",
"=",
"$",
"app",
"[",
"'markdown'",
"]",
";",
"... | Register the markdown compiler class.
@return void | [
"Register",
"the",
"markdown",
"compiler",
"class",
"."
] | train | https://github.com/GrahamCampbell/Laravel-Markdown/blob/e076ed4bc8e98f0444b996acdd6042f6f45fe7c2/src/MarkdownServiceProvider.php#L204-L215 |
sc0Vu/web3.php | src/Formatters/AddressFormatter.php | AddressFormatter.format | public static function format($value)
{
$value = (string) $value;
if (Utils::isAddress($value)) {
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
return $value;
}
return '0x' . $value;
}
$value = I... | php | public static function format($value)
{
$value = (string) $value;
if (Utils::isAddress($value)) {
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
return $value;
}
return '0x' . $value;
}
$value = I... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"Utils",
"::",
"isAddress",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"mb_strtolower",
"(",
"$",
... | format
to do: iban
@param mixed $value
@return string | [
"format",
"to",
"do",
":",
"iban"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/AddressFormatter.php#L28-L43 |
sc0Vu/web3.php | src/Contract.php | Contract.at | public function at($address)
{
if (AddressValidator::validate($address) === false) {
throw new InvalidArgumentException('Please make sure address is valid.');
}
$this->toAddress = AddressFormatter::format($address);
return $this;
} | php | public function at($address)
{
if (AddressValidator::validate($address) === false) {
throw new InvalidArgumentException('Please make sure address is valid.');
}
$this->toAddress = AddressFormatter::format($address);
return $this;
} | [
"public",
"function",
"at",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"AddressValidator",
"::",
"validate",
"(",
"$",
"address",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please make sure address is valid.'",
")",
";",
"... | at
@param string $address
@return $this | [
"at"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L334-L342 |
sc0Vu/web3.php | src/Contract.php | Contract.bytecode | public function bytecode($bytecode)
{
if (HexValidator::validate($bytecode) === false) {
throw new InvalidArgumentException('Please make sure bytecode is valid.');
}
$this->bytecode = Utils::stripZero($bytecode);
return $this;
} | php | public function bytecode($bytecode)
{
if (HexValidator::validate($bytecode) === false) {
throw new InvalidArgumentException('Please make sure bytecode is valid.');
}
$this->bytecode = Utils::stripZero($bytecode);
return $this;
} | [
"public",
"function",
"bytecode",
"(",
"$",
"bytecode",
")",
"{",
"if",
"(",
"HexValidator",
"::",
"validate",
"(",
"$",
"bytecode",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please make sure bytecode is valid.'",
")",
";"... | bytecode
@param string $bytecode
@return $this | [
"bytecode"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L350-L358 |
sc0Vu/web3.php | src/Contract.php | Contract.abi | public function abi($abi)
{
if (StringValidator::validate($abi) === false) {
throw new InvalidArgumentException('Please make sure abi is valid.');
}
$abiArray = [];
if (is_string($abi)) {
$abiArray = json_decode($abi, true);
if (JSON_ERROR_NONE !=... | php | public function abi($abi)
{
if (StringValidator::validate($abi) === false) {
throw new InvalidArgumentException('Please make sure abi is valid.');
}
$abiArray = [];
if (is_string($abi)) {
$abiArray = json_decode($abi, true);
if (JSON_ERROR_NONE !=... | [
"public",
"function",
"abi",
"(",
"$",
"abi",
")",
"{",
"if",
"(",
"StringValidator",
"::",
"validate",
"(",
"$",
"abi",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please make sure abi is valid.'",
")",
";",
"}",
"$",
... | abi
@param string $abi
@return $this | [
"abi"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L366-L396 |
sc0Vu/web3.php | src/Contract.php | Contract.new | public function new()
{
if (isset($this->constructor)) {
$constructor = $this->constructor;
$arguments = func_get_args();
$callback = array_pop($arguments);
$input_count = isset($constructor['inputs']) ? count($constructor['inputs']) : 0;
if (coun... | php | public function new()
{
if (isset($this->constructor)) {
$constructor = $this->constructor;
$arguments = func_get_args();
$callback = array_pop($arguments);
$input_count = isset($constructor['inputs']) ? count($constructor['inputs']) : 0;
if (coun... | [
"public",
"function",
"new",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"constructor",
")",
")",
"{",
"$",
"constructor",
"=",
"$",
"this",
"->",
"constructor",
";",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"$",
"callbac... | new
Deploy a contruct with params.
@param mixed
@return void | [
"new",
"Deploy",
"a",
"contruct",
"with",
"params",
"."
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L405-L438 |
sc0Vu/web3.php | src/Contract.php | Contract.send | public function send()
{
if (isset($this->functions)) {
$arguments = func_get_args();
$method = array_splice($arguments, 0, 1)[0];
$callback = array_pop($arguments);
if (!is_string($method)) {
throw new InvalidArgumentException('Please make su... | php | public function send()
{
if (isset($this->functions)) {
$arguments = func_get_args();
$method = array_splice($arguments, 0, 1)[0];
$callback = array_pop($arguments);
if (!is_string($method)) {
throw new InvalidArgumentException('Please make su... | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"functions",
")",
")",
"{",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"$",
"method",
"=",
"array_splice",
"(",
"$",
"arguments",
",",
"0",
",",
"1... | send
Send function method.
@param mixed
@return void | [
"send",
"Send",
"function",
"method",
"."
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L447-L533 |
sc0Vu/web3.php | src/Contract.php | Contract.estimateGas | public function estimateGas()
{
if (isset($this->functions) || isset($this->constructor)) {
$arguments = func_get_args();
$callback = array_pop($arguments);
if (empty($this->toAddress) && !empty($this->bytecode)) {
$constructor = $this->constructor;
... | php | public function estimateGas()
{
if (isset($this->functions) || isset($this->constructor)) {
$arguments = func_get_args();
$callback = array_pop($arguments);
if (empty($this->toAddress) && !empty($this->bytecode)) {
$constructor = $this->constructor;
... | [
"public",
"function",
"estimateGas",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"functions",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"constructor",
")",
")",
"{",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"$",
"callba... | estimateGas
Estimate function gas.
@param mixed
@return void | [
"estimateGas",
"Estimate",
"function",
"gas",
"."
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L639-L748 |
sc0Vu/web3.php | src/Contract.php | Contract.getData | public function getData()
{
if (isset($this->functions) || isset($this->constructor)) {
$arguments = func_get_args();
$functionData = '';
if (empty($this->toAddress) && !empty($this->bytecode)) {
$constructor = $this->constructor;
if (cou... | php | public function getData()
{
if (isset($this->functions) || isset($this->constructor)) {
$arguments = func_get_args();
$functionData = '';
if (empty($this->toAddress) && !empty($this->bytecode)) {
$constructor = $this->constructor;
if (cou... | [
"public",
"function",
"getData",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"functions",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"constructor",
")",
")",
"{",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"$",
"functionDa... | getData
Get the function method call data.
With this function, you can send signed contract function transaction.
1. Get the funtion data with params.
2. Sign the data with user private key.
3. Call sendRawTransaction.
@param mixed
@return void | [
"getData",
"Get",
"the",
"function",
"method",
"call",
"data",
".",
"With",
"this",
"function",
"you",
"can",
"send",
"signed",
"contract",
"function",
"transaction",
".",
"1",
".",
"Get",
"the",
"funtion",
"data",
"with",
"params",
".",
"2",
".",
"Sign",
... | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contract.php#L761-L819 |
sc0Vu/web3.php | src/Methods/JSONRPC.php | JSONRPC.toPayload | public function toPayload()
{
if (empty($this->method) || !is_string($this->method)) {
throw new InvalidArgumentException('Please check the method set properly.');
}
if (empty($this->id)) {
$id = rand();
} else {
$id = $this->id;
}
... | php | public function toPayload()
{
if (empty($this->method) || !is_string($this->method)) {
throw new InvalidArgumentException('Please check the method set properly.');
}
if (empty($this->id)) {
$id = rand();
} else {
$id = $this->id;
}
... | [
"public",
"function",
"toPayload",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"method",
")",
"||",
"!",
"is_string",
"(",
"$",
"this",
"->",
"method",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please check the method... | toPayload
@return array | [
"toPayload"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Methods/JSONRPC.php#L182-L202 |
sc0Vu/web3.php | src/Validators/FilterValidator.php | FilterValidator.validate | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (
isset($value['fromBlock']) &&
QuantityValidator::validate($value['fromBlock']) === false &&
TagValidator::validate($value['fromBlock']) === false
... | php | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (
isset($value['fromBlock']) &&
QuantityValidator::validate($value['fromBlock']) === false &&
TagValidator::validate($value['fromBlock']) === false
... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'fromBlock'",
"]",
")",
"&&",
"Quantity... | validate
@param array $value
@return bool | [
"validate"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Validators/FilterValidator.php#L28-L74 |
sc0Vu/web3.php | src/Methods/EthMethod.php | EthMethod.validate | public function validate(&$params)
{
if (!is_array($params)) {
throw new InvalidArgumentException('Please use array params when call validate.');
}
$rules = $this->validators;
if (count($params) < count($rules)) {
if (!isset($this->defaultValues) || empty($th... | php | public function validate(&$params)
{
if (!is_array($params)) {
throw new InvalidArgumentException('Please use array params when call validate.');
}
$rules = $this->validators;
if (count($params) < count($rules)) {
if (!isset($this->defaultValues) || empty($th... | [
"public",
"function",
"validate",
"(",
"&",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please use array params when call validate.'",
")",
";",
"}",
"$",
"rules",
... | validate
@param array $params
@return bool | [
"validate"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Methods/EthMethod.php#L87-L133 |
sc0Vu/web3.php | src/Methods/EthMethod.php | EthMethod.transform | public function transform($params, $rules)
{
if (!is_array($params)) {
throw new InvalidArgumentException('Please use array params when call transform.');
}
if (!is_array($rules)) {
throw new InvalidArgumentException('Please use array rules when call transform.');
... | php | public function transform($params, $rules)
{
if (!is_array($params)) {
throw new InvalidArgumentException('Please use array params when call transform.');
}
if (!is_array($rules)) {
throw new InvalidArgumentException('Please use array rules when call transform.');
... | [
"public",
"function",
"transform",
"(",
"$",
"params",
",",
"$",
"rules",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Please use array params when call transform.'",
")",
";",
"}",... | transform
@param array $params
@param array $rules
@return array | [
"transform"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Methods/EthMethod.php#L142-L157 |
sc0Vu/web3.php | src/Formatters/IntegerFormatter.php | IntegerFormatter.format | public static function format($value)
{
$value = (string) $value;
$arguments = func_get_args();
$digit = 64;
if (isset($arguments[1]) && is_numeric($arguments[1])) {
$digit = intval($arguments[1]);
}
$bn = Utils::toBn($value);
$bnHex = $bn->toHex(... | php | public static function format($value)
{
$value = (string) $value;
$arguments = func_get_args();
$digit = 64;
if (isset($arguments[1]) && is_numeric($arguments[1])) {
$digit = intval($arguments[1]);
}
$bn = Utils::toBn($value);
$bnHex = $bn->toHex(... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"$",
"digit",
"=",
"64",
";",
"if",
"(",
"isset",
"(",
"$",
"a... | format
@param mixed $value
@return string | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/IntegerFormatter.php#L26-L43 |
sc0Vu/web3.php | src/Formatters/HexFormatter.php | HexFormatter.format | public static function format($value)
{
$value = Utils::toString($value);
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
return $value;
} else {
$value = Utils::toHex($value, true);
}
return $value;
} | php | public static function format($value)
{
$value = Utils::toString($value);
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
return $value;
} else {
$value = Utils::toHex($value, true);
}
return $value;
} | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"toString",
"(",
"$",
"value",
")",
";",
"$",
"value",
"=",
"mb_strtolower",
"(",
"$",
"value",
")",
";",
"if",
"(",
"Utils",
"::",
"isZeroPrefix... | format
@param mixed $value
@return string | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/HexFormatter.php#L26-L37 |
sc0Vu/web3.php | src/Validators/TransactionValidator.php | TransactionValidator.validate | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (!isset($value['from'])) {
return false;
}
if (AddressValidator::validate($value['from']) === false) {
return false;
}
if (isset($value['t... | php | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (!isset($value['from'])) {
return false;
}
if (AddressValidator::validate($value['from']) === false) {
return false;
}
if (isset($value['t... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
"[",
"'from'",
"]",
")",
")",
"{",
"... | validate
To do: check is data optional?
Data is not optional on spec, see https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
@param array $value
@return bool | [
"validate",
"To",
"do",
":",
"check",
"is",
"data",
"optional?",
"Data",
"is",
"not",
"optional",
"on",
"spec",
"see",
"https",
":",
"//",
"github",
".",
"com",
"/",
"ethereum",
"/",
"wiki",
"/",
"wiki",
"/",
"JSON",
"-",
"RPC#eth_sendtransaction"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Validators/TransactionValidator.php#L29-L65 |
sc0Vu/web3.php | src/Validators/ShhFilterValidator.php | ShhFilterValidator.validate | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
return false;
}
if (!isset($value['topics']) || !is_array($value['topics'])) {
... | php | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
return false;
}
if (!isset($value['topics']) || !is_array($value['topics'])) {
... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'to'",
"]",
")",
"&&",
"IdentityValidat... | validate
@param array $value
@return bool | [
"validate"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Validators/ShhFilterValidator.php#L27-L54 |
sc0Vu/web3.php | src/Formatters/PostFormatter.php | PostFormatter.format | public static function format($value)
{
if (isset($value['priority'])) {
$value['priority'] = QuantityFormatter::format($value['priority']);
}
if (isset($value['ttl'])) {
$value['ttl'] = QuantityFormatter::format($value['ttl']);
}
return $value;
} | php | public static function format($value)
{
if (isset($value['priority'])) {
$value['priority'] = QuantityFormatter::format($value['priority']);
}
if (isset($value['ttl'])) {
$value['ttl'] = QuantityFormatter::format($value['ttl']);
}
return $value;
} | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'priority'",
"]",
")",
")",
"{",
"$",
"value",
"[",
"'priority'",
"]",
"=",
"QuantityFormatter",
"::",
"format",
"(",
"$",
"value",
"[... | format
@param mixed $value
@return string | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/PostFormatter.php#L27-L36 |
sc0Vu/web3.php | src/Contracts/Types/DynamicBytes.php | DynamicBytes.inputFormat | public function inputFormat($value, $name)
{
if (!Utils::isHex($value)) {
throw new InvalidArgumentException('The value to inputFormat must be hex bytes.');
}
$value = Utils::stripZero($value);
if (mb_strlen($value) % 2 !== 0) {
$value = "0" . $value;
... | php | public function inputFormat($value, $name)
{
if (!Utils::isHex($value)) {
throw new InvalidArgumentException('The value to inputFormat must be hex bytes.');
}
$value = Utils::stripZero($value);
if (mb_strlen($value) % 2 !== 0) {
$value = "0" . $value;
... | [
"public",
"function",
"inputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"Utils",
"::",
"isHex",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The value to inputFormat must be hex bytes.'",
")",... | inputFormat
@param mixed $value
@param string $name
@return string | [
"inputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/DynamicBytes.php#L59-L81 |
sc0Vu/web3.php | src/Contracts/Types/DynamicBytes.php | DynamicBytes.outputFormat | public function outputFormat($value, $name)
{
$checkZero = str_replace('0', '', $value);
if (empty($checkZero)) {
return '0';
}
$size = intval(Utils::toBn('0x' . mb_substr($value, 0, 64))->toString());
$length = 2 * $size;
return '0x' . mb_substr... | php | public function outputFormat($value, $name)
{
$checkZero = str_replace('0', '', $value);
if (empty($checkZero)) {
return '0';
}
$size = intval(Utils::toBn('0x' . mb_substr($value, 0, 64))->toString());
$length = 2 * $size;
return '0x' . mb_substr... | [
"public",
"function",
"outputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"checkZero",
"=",
"str_replace",
"(",
"'0'",
",",
"''",
",",
"$",
"value",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"checkZero",
")",
")",
"{",
"return",
"'0'"... | outputFormat
@param mixed $value
@param string $name
@return string | [
"outputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/DynamicBytes.php#L90-L101 |
sc0Vu/web3.php | src/Providers/HttpProvider.php | HttpProvider.send | public function send($method, $callback)
{
$payload = $method->toPayloadString();
if (!$this->isBatch) {
$proxy = function ($err, $res) use ($method, $callback) {
if ($err !== null) {
return call_user_func($callback, $err, null);
}
... | php | public function send($method, $callback)
{
$payload = $method->toPayloadString();
if (!$this->isBatch) {
$proxy = function ($err, $res) use ($method, $callback) {
if ($err !== null) {
return call_user_func($callback, $err, null);
}
... | [
"public",
"function",
"send",
"(",
"$",
"method",
",",
"$",
"callback",
")",
"{",
"$",
"payload",
"=",
"$",
"method",
"->",
"toPayloadString",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isBatch",
")",
"{",
"$",
"proxy",
"=",
"function",
"("... | send
@param \Web3\Methods\Method $method
@param callable $callback
@return void | [
"send"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Providers/HttpProvider.php#L45-L67 |
sc0Vu/web3.php | src/Providers/HttpProvider.php | HttpProvider.execute | public function execute($callback)
{
if (!$this->isBatch) {
throw new \RuntimeException('Please batch json rpc first.');
}
$methods = $this->methods;
$proxy = function ($err, $res) use ($methods, $callback) {
if ($err !== null) {
return call_us... | php | public function execute($callback)
{
if (!$this->isBatch) {
throw new \RuntimeException('Please batch json rpc first.');
}
$methods = $this->methods;
$proxy = function ($err, $res) use ($methods, $callback) {
if ($err !== null) {
return call_us... | [
"public",
"function",
"execute",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isBatch",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Please batch json rpc first.'",
")",
";",
"}",
"$",
"methods",
"=",
"$",
"this",
"->... | execute
@param callable $callback
@return void | [
"execute"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Providers/HttpProvider.php#L88-L114 |
sc0Vu/web3.php | src/Contracts/Types/Address.php | Address.inputFormat | public function inputFormat($value, $name)
{
$value = (string) $value;
if (Utils::isAddress($value)) {
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
$value = Utils::stripZero($value);
}
}
$value = IntegerFor... | php | public function inputFormat($value, $name)
{
$value = (string) $value;
if (Utils::isAddress($value)) {
$value = mb_strtolower($value);
if (Utils::isZeroPrefixed($value)) {
$value = Utils::stripZero($value);
}
}
$value = IntegerFor... | [
"public",
"function",
"inputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"Utils",
"::",
"isAddress",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"mb_strtolower... | inputFormat
to do: iban
@param mixed $value
@param string $name
@return string | [
"inputFormat",
"to",
"do",
":",
"iban"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Address.php#L61-L75 |
sc0Vu/web3.php | src/Contracts/Types/Boolean.php | Boolean.inputFormat | public function inputFormat($value, $name)
{
if (!is_bool($value)) {
throw new InvalidArgumentException('The value to inputFormat function must be boolean.');
}
$value = (int) $value;
return '000000000000000000000000000000000000000000000000000000000000000' . $value;
... | php | public function inputFormat($value, $name)
{
if (!is_bool($value)) {
throw new InvalidArgumentException('The value to inputFormat function must be boolean.');
}
$value = (int) $value;
return '000000000000000000000000000000000000000000000000000000000000000' . $value;
... | [
"public",
"function",
"inputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The value to inputFormat function must be boolean.'",
")",
";",
... | inputFormat
@param mixed $value
@param string $name
@return string | [
"inputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Boolean.php#L58-L66 |
sc0Vu/web3.php | src/Formatters/NumberFormatter.php | NumberFormatter.format | public static function format($value)
{
$value = Utils::toString($value);
$bn = Utils::toBn($value);
$int = (int) $bn->toString();
return $int;
} | php | public static function format($value)
{
$value = Utils::toString($value);
$bn = Utils::toBn($value);
$int = (int) $bn->toString();
return $int;
} | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"toString",
"(",
"$",
"value",
")",
";",
"$",
"bn",
"=",
"Utils",
"::",
"toBn",
"(",
"$",
"value",
")",
";",
"$",
"int",
"=",
"(",
"int",
"... | format
@param mixed $value
@return int | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/NumberFormatter.php#L26-L33 |
sc0Vu/web3.php | src/Contracts/Types/Str.php | Str.inputFormat | public function inputFormat($value, $name)
{
$value = Utils::toHex($value);
$prefix = IntegerFormatter::format(mb_strlen($value) / 2);
$l = floor((mb_strlen($value) + 63) / 64);
$padding = (($l * 64 - mb_strlen($value) + 1) >= 0) ? $l * 64 - mb_strlen($value) : 0;
return $pr... | php | public function inputFormat($value, $name)
{
$value = Utils::toHex($value);
$prefix = IntegerFormatter::format(mb_strlen($value) / 2);
$l = floor((mb_strlen($value) + 63) / 64);
$padding = (($l * 64 - mb_strlen($value) + 1) >= 0) ? $l * 64 - mb_strlen($value) : 0;
return $pr... | [
"public",
"function",
"inputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"toHex",
"(",
"$",
"value",
")",
";",
"$",
"prefix",
"=",
"IntegerFormatter",
"::",
"format",
"(",
"mb_strlen",
"(",
"$",
"value",
"... | inputFormat
@param mixed $value
@param string $name
@return string | [
"inputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Str.php#L60-L68 |
sc0Vu/web3.php | src/Contracts/Types/Str.php | Str.outputFormat | public function outputFormat($value, $name)
{
$strLen = mb_substr($value, 0, 64);
$strValue = mb_substr($value, 64);
$match = [];
if (preg_match('/^[0]+([a-f0-9]+)$/', $strLen, $match) === 1) {
$strLen = BigNumberFormatter::format('0x' . $match[1])->toString();
}... | php | public function outputFormat($value, $name)
{
$strLen = mb_substr($value, 0, 64);
$strValue = mb_substr($value, 64);
$match = [];
if (preg_match('/^[0]+([a-f0-9]+)$/', $strLen, $match) === 1) {
$strLen = BigNumberFormatter::format('0x' . $match[1])->toString();
}... | [
"public",
"function",
"outputFormat",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"$",
"strLen",
"=",
"mb_substr",
"(",
"$",
"value",
",",
"0",
",",
"64",
")",
";",
"$",
"strValue",
"=",
"mb_substr",
"(",
"$",
"value",
",",
"64",
")",
";",
"$"... | outputFormat
@param mixed $value
@param string $name
@return string | [
"outputFormat"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Contracts/Types/Str.php#L77-L89 |
sc0Vu/web3.php | src/Formatters/TransactionFormatter.php | TransactionFormatter.format | public static function format($value)
{
if (isset($value['gas'])) {
$value['gas'] = QuantityFormatter::format($value['gas']);
}
if (isset($value['gasPrice'])) {
$value['gasPrice'] = QuantityFormatter::format($value['gasPrice']);
}
if (isset($value['val... | php | public static function format($value)
{
if (isset($value['gas'])) {
$value['gas'] = QuantityFormatter::format($value['gas']);
}
if (isset($value['gasPrice'])) {
$value['gasPrice'] = QuantityFormatter::format($value['gasPrice']);
}
if (isset($value['val... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'gas'",
"]",
")",
")",
"{",
"$",
"value",
"[",
"'gas'",
"]",
"=",
"QuantityFormatter",
"::",
"format",
"(",
"$",
"value",
"[",
"'gas... | format
@param mixed $value
@return string | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/TransactionFormatter.php#L28-L46 |
sc0Vu/web3.php | src/Validators/PostValidator.php | PostValidator.validate | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (isset($value['from']) && IdentityValidator::validate($value['from']) === false) {
return false;
}
if (isset($value['to']) && IdentityValidator::validate($value['to']... | php | public static function validate($value)
{
if (!is_array($value)) {
return false;
}
if (isset($value['from']) && IdentityValidator::validate($value['from']) === false) {
return false;
}
if (isset($value['to']) && IdentityValidator::validate($value['to']... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'from'",
"]",
")",
"&&",
"IdentityValid... | validate
@param array $value
@return bool | [
"validate"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Validators/PostValidator.php#L27-L65 |
sc0Vu/web3.php | src/Validators/TagValidator.php | TagValidator.validate | public static function validate($value)
{
$value = Utils::toString($value);
$tags = [
'latest', 'earliest', 'pending'
];
return in_array($value, $tags);
} | php | public static function validate($value)
{
$value = Utils::toString($value);
$tags = [
'latest', 'earliest', 'pending'
];
return in_array($value, $tags);
} | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"toString",
"(",
"$",
"value",
")",
";",
"$",
"tags",
"=",
"[",
"'latest'",
",",
"'earliest'",
",",
"'pending'",
"]",
";",
"return",
"in_array",
... | validate
@param string $value
@return bool | [
"validate"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Validators/TagValidator.php#L25-L33 |
sc0Vu/web3.php | src/Web3.php | Web3.getEth | public function getEth()
{
if (!isset($this->eth)) {
$eth = new Eth($this->provider);
$this->eth = $eth;
}
return $this->eth;
} | php | public function getEth()
{
if (!isset($this->eth)) {
$eth = new Eth($this->provider);
$this->eth = $eth;
}
return $this->eth;
} | [
"public",
"function",
"getEth",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"eth",
")",
")",
"{",
"$",
"eth",
"=",
"new",
"Eth",
"(",
"$",
"this",
"->",
"provider",
")",
";",
"$",
"this",
"->",
"eth",
"=",
"$",
"eth",
";",... | getEth
@return \Web3\Eth | [
"getEth"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Web3.php#L213-L220 |
sc0Vu/web3.php | src/Web3.php | Web3.getNet | public function getNet()
{
if (!isset($this->net)) {
$net = new Net($this->provider);
$this->net = $net;
}
return $this->net;
} | php | public function getNet()
{
if (!isset($this->net)) {
$net = new Net($this->provider);
$this->net = $net;
}
return $this->net;
} | [
"public",
"function",
"getNet",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"net",
")",
")",
"{",
"$",
"net",
"=",
"new",
"Net",
"(",
"$",
"this",
"->",
"provider",
")",
";",
"$",
"this",
"->",
"net",
"=",
"$",
"net",
";",... | getNet
@return \Web3\Net | [
"getNet"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Web3.php#L227-L234 |
sc0Vu/web3.php | src/Web3.php | Web3.getPersonal | public function getPersonal()
{
if (!isset($this->personal)) {
$personal = new Personal($this->provider);
$this->personal = $personal;
}
return $this->personal;
} | php | public function getPersonal()
{
if (!isset($this->personal)) {
$personal = new Personal($this->provider);
$this->personal = $personal;
}
return $this->personal;
} | [
"public",
"function",
"getPersonal",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"personal",
")",
")",
"{",
"$",
"personal",
"=",
"new",
"Personal",
"(",
"$",
"this",
"->",
"provider",
")",
";",
"$",
"this",
"->",
"personal",
"=... | getPersonal
@return \Web3\Personal | [
"getPersonal"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Web3.php#L241-L248 |
sc0Vu/web3.php | src/Web3.php | Web3.getShh | public function getShh()
{
if (!isset($this->shh)) {
$shh = new Shh($this->provider);
$this->shh = $shh;
}
return $this->shh;
} | php | public function getShh()
{
if (!isset($this->shh)) {
$shh = new Shh($this->provider);
$this->shh = $shh;
}
return $this->shh;
} | [
"public",
"function",
"getShh",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shh",
")",
")",
"{",
"$",
"shh",
"=",
"new",
"Shh",
"(",
"$",
"this",
"->",
"provider",
")",
";",
"$",
"this",
"->",
"shh",
"=",
"$",
"shh",
";",... | getShh
@return \Web3\Shh | [
"getShh"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Web3.php#L255-L262 |
sc0Vu/web3.php | src/Web3.php | Web3.getUtils | public function getUtils()
{
if (!isset($this->utils)) {
$utils = new Utils;
$this->utils = $utils;
}
return $this->utils;
} | php | public function getUtils()
{
if (!isset($this->utils)) {
$utils = new Utils;
$this->utils = $utils;
}
return $this->utils;
} | [
"public",
"function",
"getUtils",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"utils",
")",
")",
"{",
"$",
"utils",
"=",
"new",
"Utils",
";",
"$",
"this",
"->",
"utils",
"=",
"$",
"utils",
";",
"}",
"return",
"$",
"this",
"-... | getUtils
@return \Web3\Utils | [
"getUtils"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Web3.php#L269-L276 |
sc0Vu/web3.php | src/Formatters/QuantityFormatter.php | QuantityFormatter.format | public static function format($value)
{
$value = Utils::toString($value);
if (Utils::isZeroPrefixed($value)) {
// test hex with zero ahead, hardcode 0x0
if ($value === '0x0' || strpos($value, '0x0') !== 0) {
return $value;
}
$hex = pre... | php | public static function format($value)
{
$value = Utils::toString($value);
if (Utils::isZeroPrefixed($value)) {
// test hex with zero ahead, hardcode 0x0
if ($value === '0x0' || strpos($value, '0x0') !== 0) {
return $value;
}
$hex = pre... | [
"public",
"static",
"function",
"format",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"Utils",
"::",
"toString",
"(",
"$",
"value",
")",
";",
"if",
"(",
"Utils",
"::",
"isZeroPrefixed",
"(",
"$",
"value",
")",
")",
"{",
"// test hex with zero ahead, ... | format
@param mixed $value
@return string | [
"format"
] | train | https://github.com/sc0Vu/web3.php/blob/b6fc44d9e3f6b56023b3ad11196d573fdded68d4/src/Formatters/QuantityFormatter.php#L26-L46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.