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
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.getFriendsCount
public function getFriendsCount($groupSlug = '') { $friendsCount = $this->findFriendships(Status::ACCEPTED, $groupSlug)->count(); return $friendsCount; }
php
public function getFriendsCount($groupSlug = '') { $friendsCount = $this->findFriendships(Status::ACCEPTED, $groupSlug)->count(); return $friendsCount; }
[ "public", "function", "getFriendsCount", "(", "$", "groupSlug", "=", "''", ")", "{", "$", "friendsCount", "=", "$", "this", "->", "findFriendships", "(", "Status", "::", "ACCEPTED", ",", "$", "groupSlug", ")", "->", "count", "(", ")", ";", "return", "$",...
Get the number of friends @param string $groupSlug @return integer
[ "Get", "the", "number", "of", "friends" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L360-L364
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.canBefriend
public function canBefriend($recipient) { // if user has Blocked the recipient and changed his mind // he can send a friend request after unblocking if ($this->hasBlocked($recipient)) { $this->unblockFriend($recipient); return true; } // if sender has...
php
public function canBefriend($recipient) { // if user has Blocked the recipient and changed his mind // he can send a friend request after unblocking if ($this->hasBlocked($recipient)) { $this->unblockFriend($recipient); return true; } // if sender has...
[ "public", "function", "canBefriend", "(", "$", "recipient", ")", "{", "// if user has Blocked the recipient and changed his mind", "// he can send a friend request after unblocking", "if", "(", "$", "this", "->", "hasBlocked", "(", "$", "recipient", ")", ")", "{", "$", ...
@param Model $recipient @return bool
[ "@param", "Model", "$recipient" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L371-L388
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.findFriendships
private function findFriendships($status = null, $groupSlug = '') { $query = Friendship::where(function ($query) { $query->where(function ($q) { $q->whereSender($this); })->orWhere(function ($q) { $q->whereRecipient($this); }); })-...
php
private function findFriendships($status = null, $groupSlug = '') { $query = Friendship::where(function ($query) { $query->where(function ($q) { $q->whereSender($this); })->orWhere(function ($q) { $q->whereRecipient($this); }); })-...
[ "private", "function", "findFriendships", "(", "$", "status", "=", "null", ",", "$", "groupSlug", "=", "''", ")", "{", "$", "query", "=", "Friendship", "::", "where", "(", "function", "(", "$", "query", ")", "{", "$", "query", "->", "where", "(", "fu...
@param $status @param string $groupSlug @return \Illuminate\Database\Eloquent\Collection
[ "@param", "$status", "@param", "string", "$groupSlug" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L406-L423
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.getFriendsQueryBuilder
private function getFriendsQueryBuilder($groupSlug = '') { $friendships = $this->findFriendships(Status::ACCEPTED, $groupSlug)->get(['sender_id', 'recipient_id']); $recipients = $friendships->pluck('recipient_id')->all(); $senders = $friendships->pluck('sender_id')->all(); ret...
php
private function getFriendsQueryBuilder($groupSlug = '') { $friendships = $this->findFriendships(Status::ACCEPTED, $groupSlug)->get(['sender_id', 'recipient_id']); $recipients = $friendships->pluck('recipient_id')->all(); $senders = $friendships->pluck('sender_id')->all(); ret...
[ "private", "function", "getFriendsQueryBuilder", "(", "$", "groupSlug", "=", "''", ")", "{", "$", "friendships", "=", "$", "this", "->", "findFriendships", "(", "Status", "::", "ACCEPTED", ",", "$", "groupSlug", ")", "->", "get", "(", "[", "'sender_id'", "...
Get the query builder of the 'friend' model @param string $groupSlug @return \Illuminate\Database\Eloquent\Builder
[ "Get", "the", "query", "builder", "of", "the", "friend", "model" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L432-L440
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.getMutualFriendsQueryBuilder
private function getMutualFriendsQueryBuilder(Model $other) { $user1['friendships'] = $this->findFriendships(Status::ACCEPTED)->get(['sender_id', 'recipient_id']); $user1['recipients'] = $user1['friendships']->pluck('recipient_id')->all(); $user1['senders'] = $user1['friendships']->pluck('se...
php
private function getMutualFriendsQueryBuilder(Model $other) { $user1['friendships'] = $this->findFriendships(Status::ACCEPTED)->get(['sender_id', 'recipient_id']); $user1['recipients'] = $user1['friendships']->pluck('recipient_id')->all(); $user1['senders'] = $user1['friendships']->pluck('se...
[ "private", "function", "getMutualFriendsQueryBuilder", "(", "Model", "$", "other", ")", "{", "$", "user1", "[", "'friendships'", "]", "=", "$", "this", "->", "findFriendships", "(", "Status", "::", "ACCEPTED", ")", "->", "get", "(", "[", "'sender_id'", ",", ...
Get the query builder of the 'friend' model @return \Illuminate\Database\Eloquent\Builder
[ "Get", "the", "query", "builder", "of", "the", "friend", "model" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L447-L465
hootlex/laravel-friendships
src/Traits/Friendable.php
Friendable.friendsOfFriendsQueryBuilder
private function friendsOfFriendsQueryBuilder($groupSlug = '') { $friendships = $this->findFriendships(Status::ACCEPTED)->get(['sender_id', 'recipient_id']); $recipients = $friendships->pluck('recipient_id')->all(); $senders = $friendships->pluck('sender_id')->all(); $friendIds = ar...
php
private function friendsOfFriendsQueryBuilder($groupSlug = '') { $friendships = $this->findFriendships(Status::ACCEPTED)->get(['sender_id', 'recipient_id']); $recipients = $friendships->pluck('recipient_id')->all(); $senders = $friendships->pluck('sender_id')->all(); $friendIds = ar...
[ "private", "function", "friendsOfFriendsQueryBuilder", "(", "$", "groupSlug", "=", "''", ")", "{", "$", "friendships", "=", "$", "this", "->", "findFriendships", "(", "Status", "::", "ACCEPTED", ")", "->", "get", "(", "[", "'sender_id'", ",", "'recipient_id'",...
Get the query builder for friendsOfFriends ('friend' model) @param string $groupSlug @return \Illuminate\Database\Eloquent\Builder
[ "Get", "the", "query", "builder", "for", "friendsOfFriends", "(", "friend", "model", ")" ]
train
https://github.com/hootlex/laravel-friendships/blob/0100718545bad757006737c21a7b35dc5c52b443/src/Traits/Friendable.php#L474-L507
epartment/nova-dependency-container
src/NovaDependencyContainer.php
NovaDependencyContainer.dependsOn
public function dependsOn($field, $value) { return $this->withMeta([ 'dependencies' => array_merge($this->meta['dependencies'], [['field' => $field, 'value' => $value]]) ]); }
php
public function dependsOn($field, $value) { return $this->withMeta([ 'dependencies' => array_merge($this->meta['dependencies'], [['field' => $field, 'value' => $value]]) ]); }
[ "public", "function", "dependsOn", "(", "$", "field", ",", "$", "value", ")", "{", "return", "$", "this", "->", "withMeta", "(", "[", "'dependencies'", "=>", "array_merge", "(", "$", "this", "->", "meta", "[", "'dependencies'", "]", ",", "[", "[", "'fi...
Adds a dependency @param $field @param $value @return $this
[ "Adds", "a", "dependency" ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/NovaDependencyContainer.php#L44-L49
epartment/nova-dependency-container
src/NovaDependencyContainer.php
NovaDependencyContainer.resolveAttribute
protected function resolveAttribute($resource, $attribute) { foreach ($this->meta['fields'] as $field) { $field->resolve($resource); } return []; }
php
protected function resolveAttribute($resource, $attribute) { foreach ($this->meta['fields'] as $field) { $field->resolve($resource); } return []; }
[ "protected", "function", "resolveAttribute", "(", "$", "resource", ",", "$", "attribute", ")", "{", "foreach", "(", "$", "this", "->", "meta", "[", "'fields'", "]", "as", "$", "field", ")", "{", "$", "field", "->", "resolve", "(", "$", "resource", ")",...
Retrieve values of dependency fields @param mixed $resource @param string $attribute @return array|mixed
[ "Retrieve", "values", "of", "dependency", "fields" ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/NovaDependencyContainer.php#L90-L97
epartment/nova-dependency-container
src/NovaDependencyContainer.php
NovaDependencyContainer.fillAttributeFromRequest
protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute) { foreach ($this->meta['fields'] as $field) { $field->fill($request, $model); } }
php
protected function fillAttributeFromRequest(NovaRequest $request, $requestAttribute, $model, $attribute) { foreach ($this->meta['fields'] as $field) { $field->fill($request, $model); } }
[ "protected", "function", "fillAttributeFromRequest", "(", "NovaRequest", "$", "request", ",", "$", "requestAttribute", ",", "$", "model", ",", "$", "attribute", ")", "{", "foreach", "(", "$", "this", "->", "meta", "[", "'fields'", "]", "as", "$", "field", ...
Fills the attributes of the model within the container if the dependencies for the container are satisfied. @param NovaRequest $request @param string $requestAttribute @param object $model @param string $attribute
[ "Fills", "the", "attributes", "of", "the", "model", "within", "the", "container", "if", "the", "dependencies", "for", "the", "container", "are", "satisfied", "." ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/NovaDependencyContainer.php#L107-L112
epartment/nova-dependency-container
src/Http/Controllers/ActionController.php
ActionController.index
public function index(NovaRequest $request) { return response()->json([ 'actions' => $request->newResource()->availableActions($request), 'pivotActions' => [ 'name' => $request->pivotName(), 'actions' => $request->newResource()->availablePivotActions($request), ], ]); }
php
public function index(NovaRequest $request) { return response()->json([ 'actions' => $request->newResource()->availableActions($request), 'pivotActions' => [ 'name' => $request->pivotName(), 'actions' => $request->newResource()->availablePivotActions($request), ], ]); }
[ "public", "function", "index", "(", "NovaRequest", "$", "request", ")", "{", "return", "response", "(", ")", "->", "json", "(", "[", "'actions'", "=>", "$", "request", "->", "newResource", "(", ")", "->", "availableActions", "(", "$", "request", ")", ","...
List the actions for the given resource. @param \Laravel\Nova\Http\Requests\NovaRequest $request @return \Illuminate\Http\Response
[ "List", "the", "actions", "for", "the", "given", "resource", "." ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/Http/Controllers/ActionController.php#L17-L25
epartment/nova-dependency-container
src/HasDependencies.php
HasDependencies.validateFields
public function validateFields() { $availableFields = []; foreach ($this->action()->fields() as $field) { if ($field instanceof NovaDependencyContainer) { $availableFields[] = $field; $this->extractChildFields($field->meta['fields']); } else { ...
php
public function validateFields() { $availableFields = []; foreach ($this->action()->fields() as $field) { if ($field instanceof NovaDependencyContainer) { $availableFields[] = $field; $this->extractChildFields($field->meta['fields']); } else { ...
[ "public", "function", "validateFields", "(", ")", "{", "$", "availableFields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "action", "(", ")", "->", "fields", "(", ")", "as", "$", "field", ")", "{", "if", "(", "$", "field", "instanceof", ...
Validate action fields Overridden using ActionController & ActionRequest by modifying routes @return void
[ "Validate", "action", "fields", "Overridden", "using", "ActionController", "&", "ActionRequest", "by", "modifying", "routes" ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/HasDependencies.php#L93-L111
epartment/nova-dependency-container
src/FieldServiceProvider.php
FieldServiceProvider.boot
public function boot() { // Override ActionController after NovaServiceProvider loaded \Event::listen(NovaServiceProviderRegistered::class, function () { app('router')->middleware('nova')->post('/nova-api/{resource}/action', ['uses' => '\Epartment\NovaDependencyContainer...
php
public function boot() { // Override ActionController after NovaServiceProvider loaded \Event::listen(NovaServiceProviderRegistered::class, function () { app('router')->middleware('nova')->post('/nova-api/{resource}/action', ['uses' => '\Epartment\NovaDependencyContainer...
[ "public", "function", "boot", "(", ")", "{", "// Override ActionController after NovaServiceProvider loaded", "\\", "Event", "::", "listen", "(", "NovaServiceProviderRegistered", "::", "class", ",", "function", "(", ")", "{", "app", "(", "'router'", ")", "->", "midd...
Bootstrap any application services. @return void
[ "Bootstrap", "any", "application", "services", "." ]
train
https://github.com/epartment/nova-dependency-container/blob/65d3205509321b6fd04dd242e3e929b1183c82a0/src/FieldServiceProvider.php#L17-L28
yiisoft/yii2-bootstrap4
src/ButtonGroup.php
ButtonGroup.init
public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'btn-group']); if (!isset($this->options['role'])) { $this->options['role'] = 'group'; } }
php
public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'btn-group']); if (!isset($this->options['role'])) { $this->options['role'] = 'group'; } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "Html", "::", "addCssClass", "(", "$", "this", "->", "options", ",", "[", "'widget'", "=>", "'btn-group'", "]", ")", ";", "if", "(", "!", "isset", "(", "$", "this",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonGroup.php#L64-L71
yiisoft/yii2-bootstrap4
src/ButtonGroup.php
ButtonGroup.renderButtons
protected function renderButtons() { $buttons = []; foreach ($this->buttons as $button) { if (is_array($button)) { $visible = ArrayHelper::remove($button, 'visible', true); if ($visible === false) { continue; } ...
php
protected function renderButtons() { $buttons = []; foreach ($this->buttons as $button) { if (is_array($button)) { $visible = ArrayHelper::remove($button, 'visible', true); if ($visible === false) { continue; } ...
[ "protected", "function", "renderButtons", "(", ")", "{", "$", "buttons", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "buttons", "as", "$", "button", ")", "{", "if", "(", "is_array", "(", "$", "button", ")", ")", "{", "$", "visible", "=",...
Generates the buttons that compound the group as specified on [[buttons]]. @return string the rendering result. @throws \Exception
[ "Generates", "the", "buttons", "that", "compound", "the", "group", "as", "specified", "on", "[[", "buttons", "]]", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonGroup.php#L88-L112
yiisoft/yii2-bootstrap4
src/Accordion.php
Accordion.run
public function run() { $this->registerPlugin('collapse'); Html::addCssClass($this->options, 'accordion'); return implode("\n", [ Html::beginTag('div', $this->options), $this->renderItems(), Html::endTag('div') ]) . "\n"; }
php
public function run() { $this->registerPlugin('collapse'); Html::addCssClass($this->options, 'accordion'); return implode("\n", [ Html::beginTag('div', $this->options), $this->renderItems(), Html::endTag('div') ]) . "\n"; }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "registerPlugin", "(", "'collapse'", ")", ";", "Html", "::", "addCssClass", "(", "$", "this", "->", "options", ",", "'accordion'", ")", ";", "return", "implode", "(", "\"\\n\"", ",", "[", "...
{@inheritdoc} @throws InvalidConfigException
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Accordion.php#L117-L126
yiisoft/yii2-bootstrap4
src/Accordion.php
Accordion.renderItems
public function renderItems() { $items = []; $index = 0; foreach ($this->items as $key => $item) { if (!is_array($item)) { $item = ['content' => $item]; } if (!array_key_exists('label', $item)) { if (is_int($key)) { ...
php
public function renderItems() { $items = []; $index = 0; foreach ($this->items as $key => $item) { if (!is_array($item)) { $item = ['content' => $item]; } if (!array_key_exists('label', $item)) { if (is_int($key)) { ...
[ "public", "function", "renderItems", "(", ")", "{", "$", "items", "=", "[", "]", ";", "$", "index", "=", "0", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "key", "=>", "$", "item", ")", "{", "if", "(", "!", "is_array", "(", "$", ...
Renders collapsible items as specified on [[items]]. @throws InvalidConfigException if label isn't specified @return string the rendering result
[ "Renders", "collapsible", "items", "as", "specified", "on", "[[", "items", "]]", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Accordion.php#L133-L155
yiisoft/yii2-bootstrap4
src/Accordion.php
Accordion.renderItem
public function renderItem($header, $item, $index) { if (array_key_exists('content', $item)) { $id = $this->options['id'] . '-collapse' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; Html::addCssClass($options, [...
php
public function renderItem($header, $item, $index) { if (array_key_exists('content', $item)) { $id = $this->options['id'] . '-collapse' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; Html::addCssClass($options, [...
[ "public", "function", "renderItem", "(", "$", "header", ",", "$", "item", ",", "$", "index", ")", "{", "if", "(", "array_key_exists", "(", "'content'", ",", "$", "item", ")", ")", "{", "$", "id", "=", "$", "this", "->", "options", "[", "'id'", "]",...
Renders a single collapsible item group @param string $header a label of the item group [[items]] @param array $item a single item from [[items]] @param int $index the item index as each item group content must have an id @return string the rendering result @throws InvalidConfigException @throws \Exception
[ "Renders", "a", "single", "collapsible", "item", "group" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Accordion.php#L166-L240
yiisoft/yii2-bootstrap4
src/NavBar.php
NavBar.init
public function init() { parent::init(); if (!isset($this->options['class']) || empty($this->options['class'])) { Html::addCssClass($this->options, ['widget' => 'navbar', 'navbar-expand-lg', 'navbar-light', 'bg-light']); } else { Html::addCssClass($this->options, ['wi...
php
public function init() { parent::init(); if (!isset($this->options['class']) || empty($this->options['class'])) { Html::addCssClass($this->options, ['widget' => 'navbar', 'navbar-expand-lg', 'navbar-light', 'bg-light']); } else { Html::addCssClass($this->options, ['wi...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "'class'", "]", ")", "||", "empty", "(", "$", "this", "->", "options", "[", "'class'", "]", ")", ...
Initializes the widget.
[ "Initializes", "the", "widget", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/NavBar.php#L114-L157
yiisoft/yii2-bootstrap4
src/NavBar.php
NavBar.run
public function run() { $tag = ArrayHelper::remove($this->collapseOptions, 'tag', 'div'); echo Html::endTag($tag) . "\n"; if ($this->renderInnerContainer) { echo Html::endTag('div') . "\n"; } $tag = ArrayHelper::remove($this->options, 'tag', 'nav'); echo H...
php
public function run() { $tag = ArrayHelper::remove($this->collapseOptions, 'tag', 'div'); echo Html::endTag($tag) . "\n"; if ($this->renderInnerContainer) { echo Html::endTag('div') . "\n"; } $tag = ArrayHelper::remove($this->options, 'tag', 'nav'); echo H...
[ "public", "function", "run", "(", ")", "{", "$", "tag", "=", "ArrayHelper", "::", "remove", "(", "$", "this", "->", "collapseOptions", ",", "'tag'", ",", "'div'", ")", ";", "echo", "Html", "::", "endTag", "(", "$", "tag", ")", ".", "\"\\n\"", ";", ...
Renders the widget.
[ "Renders", "the", "widget", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/NavBar.php#L162-L172
yiisoft/yii2-bootstrap4
src/NavBar.php
NavBar.renderToggleButton
protected function renderToggleButton() { $options = $this->togglerOptions; Html::addCssClass($options, ['widget' => 'navbar-toggler']); return Html::button( $this->togglerContent, ArrayHelper::merge($options, [ 'type' => 'button', 'dat...
php
protected function renderToggleButton() { $options = $this->togglerOptions; Html::addCssClass($options, ['widget' => 'navbar-toggler']); return Html::button( $this->togglerContent, ArrayHelper::merge($options, [ 'type' => 'button', 'dat...
[ "protected", "function", "renderToggleButton", "(", ")", "{", "$", "options", "=", "$", "this", "->", "togglerOptions", ";", "Html", "::", "addCssClass", "(", "$", "options", ",", "[", "'widget'", "=>", "'navbar-toggler'", "]", ")", ";", "return", "Html", ...
Renders collapsible toggle button. @return string the rendering toggle button.
[ "Renders", "collapsible", "toggle", "button", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/NavBar.php#L178-L195
yiisoft/yii2-bootstrap4
src/Modal.php
Modal.run
public function run() { echo "\n" . $this->renderBodyEnd(); echo "\n" . $this->renderFooter(); echo "\n" . Html::endTag('div'); // modal-content echo "\n" . Html::endTag('div'); // modal-dialog echo "\n" . Html::endTag('div'); $this->registerPlugin('modal'); }
php
public function run() { echo "\n" . $this->renderBodyEnd(); echo "\n" . $this->renderFooter(); echo "\n" . Html::endTag('div'); // modal-content echo "\n" . Html::endTag('div'); // modal-dialog echo "\n" . Html::endTag('div'); $this->registerPlugin('modal'); }
[ "public", "function", "run", "(", ")", "{", "echo", "\"\\n\"", ".", "$", "this", "->", "renderBodyEnd", "(", ")", ";", "echo", "\"\\n\"", ".", "$", "this", "->", "renderFooter", "(", ")", ";", "echo", "\"\\n\"", ".", "Html", "::", "endTag", "(", "'di...
Renders the widget.
[ "Renders", "the", "widget", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Modal.php#L134-L143
yiisoft/yii2-bootstrap4
src/Modal.php
Modal.initOptions
protected function initOptions() { $this->options = array_merge([ 'class' => 'fade', 'role' => 'dialog', 'tabindex' => -1, 'aria-hidden' => 'true' ], $this->options); Html::addCssClass($this->options, ['widget' => 'modal']); if ($this-...
php
protected function initOptions() { $this->options = array_merge([ 'class' => 'fade', 'role' => 'dialog', 'tabindex' => -1, 'aria-hidden' => 'true' ], $this->options); Html::addCssClass($this->options, ['widget' => 'modal']); if ($this-...
[ "protected", "function", "initOptions", "(", ")", "{", "$", "this", "->", "options", "=", "array_merge", "(", "[", "'class'", "=>", "'fade'", ",", "'role'", "=>", "'dialog'", ",", "'tabindex'", "=>", "-", "1", ",", "'aria-hidden'", "=>", "'true'", "]", "...
Initializes the widget options. This method sets the default values for various options.
[ "Initializes", "the", "widget", "options", ".", "This", "method", "sets", "the", "default", "values", "for", "various", "options", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Modal.php#L239-L277
yiisoft/yii2-bootstrap4
src/ButtonDropdown.php
ButtonDropdown.init
public function init() { parent::init(); if (!isset($this->buttonOptions['id'])) { $this->buttonOptions['id'] = $this->options['id'] . '-button'; } }
php
public function init() { parent::init(); if (!isset($this->buttonOptions['id'])) { $this->buttonOptions['id'] = $this->options['id'] . '-button'; } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "buttonOptions", "[", "'id'", "]", ")", ")", "{", "$", "this", "->", "buttonOptions", "[", "'id'", "]", "=", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonDropdown.php#L106-L113
yiisoft/yii2-bootstrap4
src/ButtonDropdown.php
ButtonDropdown.run
public function run() { $html = $this->renderButton() . "\n" . $this->renderDropdown(); if ($this->renderContainer) { Html::addCssClass($this->options, ['widget' => 'drop'.$this->direction, 'btn-group']); $options = $this->options; $tag = ArrayHelper::remove($opt...
php
public function run() { $html = $this->renderButton() . "\n" . $this->renderDropdown(); if ($this->renderContainer) { Html::addCssClass($this->options, ['widget' => 'drop'.$this->direction, 'btn-group']); $options = $this->options; $tag = ArrayHelper::remove($opt...
[ "public", "function", "run", "(", ")", "{", "$", "html", "=", "$", "this", "->", "renderButton", "(", ")", ".", "\"\\n\"", ".", "$", "this", "->", "renderDropdown", "(", ")", ";", "if", "(", "$", "this", "->", "renderContainer", ")", "{", "Html", "...
{@inheritdoc} @throws \Exception
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonDropdown.php#L119-L135
yiisoft/yii2-bootstrap4
src/ButtonDropdown.php
ButtonDropdown.renderButton
protected function renderButton() { Html::addCssClass($this->buttonOptions, ['widget' => 'btn']); $label = $this->label; if ($this->encodeLabel) { $label = Html::encode($label); } if ($this->split) { $buttonOptions = $this->buttonOptions; ...
php
protected function renderButton() { Html::addCssClass($this->buttonOptions, ['widget' => 'btn']); $label = $this->label; if ($this->encodeLabel) { $label = Html::encode($label); } if ($this->split) { $buttonOptions = $this->buttonOptions; ...
[ "protected", "function", "renderButton", "(", ")", "{", "Html", "::", "addCssClass", "(", "$", "this", "->", "buttonOptions", ",", "[", "'widget'", "=>", "'btn'", "]", ")", ";", "$", "label", "=", "$", "this", "->", "label", ";", "if", "(", "$", "thi...
Generates the button dropdown. @return string the rendering result. @throws \Exception
[ "Generates", "the", "button", "dropdown", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonDropdown.php#L142-L190
yiisoft/yii2-bootstrap4
src/ButtonDropdown.php
ButtonDropdown.renderDropdown
protected function renderDropdown() { $config = $this->dropdown; $config['clientOptions'] = false; $config['view'] = $this->getView(); /** @var Widget $dropdownClass */ $dropdownClass = $this->dropdownClass; return $dropdownClass::widget($config); }
php
protected function renderDropdown() { $config = $this->dropdown; $config['clientOptions'] = false; $config['view'] = $this->getView(); /** @var Widget $dropdownClass */ $dropdownClass = $this->dropdownClass; return $dropdownClass::widget($config); }
[ "protected", "function", "renderDropdown", "(", ")", "{", "$", "config", "=", "$", "this", "->", "dropdown", ";", "$", "config", "[", "'clientOptions'", "]", "=", "false", ";", "$", "config", "[", "'view'", "]", "=", "$", "this", "->", "getView", "(", ...
Generates the dropdown menu. @return string the rendering result. @throws \Exception
[ "Generates", "the", "dropdown", "menu", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonDropdown.php#L197-L205
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.render
public function render($content = null) { if ($content === null) { if (!isset($this->parts['{beginWrapper}'])) { $options = $this->wrapperOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->parts['{beginWrapper}'] = Html::beginTag($...
php
public function render($content = null) { if ($content === null) { if (!isset($this->parts['{beginWrapper}'])) { $options = $this->wrapperOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->parts['{beginWrapper}'] = Html::beginTag($...
[ "public", "function", "render", "(", "$", "content", "=", "null", ")", "{", "if", "(", "$", "content", "===", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "parts", "[", "'{beginWrapper}'", "]", ")", ")", "{", "$", "options", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L167-L195
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.checkbox
public function checkbox($options = [], $enclosedByLabel = false) { Html::removeCssClass($options, 'form-control'); Html::addCssClass($options, 'form-check-input'); Html::addCssClass($this->labelOptions, 'form-check-label'); if (!isset($options['template'])) { $this->tem...
php
public function checkbox($options = [], $enclosedByLabel = false) { Html::removeCssClass($options, 'form-control'); Html::addCssClass($options, 'form-check-input'); Html::addCssClass($this->labelOptions, 'form-check-label'); if (!isset($options['template'])) { $this->tem...
[ "public", "function", "checkbox", "(", "$", "options", "=", "[", "]", ",", "$", "enclosedByLabel", "=", "false", ")", "{", "Html", "::", "removeCssClass", "(", "$", "options", ",", "'form-control'", ")", ";", "Html", "::", "addCssClass", "(", "$", "optio...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L200-L227
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.checkboxList
public function checkboxList($items, $options = []) { if (!isset($options['item'])) { $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : []; $encode = ArrayHelper::getValue($options, 'encode', true); $wrapperOptions = ['class' => ['form-check']]; ...
php
public function checkboxList($items, $options = []) { if (!isset($options['item'])) { $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : []; $encode = ArrayHelper::getValue($options, 'encode', true); $wrapperOptions = ['class' => ['form-check']]; ...
[ "public", "function", "checkboxList", "(", "$", "items", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'item'", "]", ")", ")", "{", "$", "itemOptions", "=", "isset", "(", "$", "options", "[", "'...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L264-L294
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.listBox
public function listBox($items, $options = []) { if ($this->form->layout === ActiveForm::LAYOUT_INLINE) { Html::removeCssClass($this->labelOptions, 'sr-only'); } return parent::listBox($items, $options); }
php
public function listBox($items, $options = []) { if ($this->form->layout === ActiveForm::LAYOUT_INLINE) { Html::removeCssClass($this->labelOptions, 'sr-only'); } return parent::listBox($items, $options); }
[ "public", "function", "listBox", "(", "$", "items", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "form", "->", "layout", "===", "ActiveForm", "::", "LAYOUT_INLINE", ")", "{", "Html", "::", "removeCssClass", "(", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L334-L341
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.staticControl
public function staticControl($options = []) { $this->adjustLabelFor($options); $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options); return $this; }
php
public function staticControl($options = []) { $this->adjustLabelFor($options); $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options); return $this; }
[ "public", "function", "staticControl", "(", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "adjustLabelFor", "(", "$", "options", ")", ";", "$", "this", "->", "parts", "[", "'{input}'", "]", "=", "Html", "::", "activeStaticControl", "(", "...
Renders Bootstrap static form control. @param array $options the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. There are also a special options: - encode: bool, whether value should be HTML-encoded or not. @return $this the field object itself @see https://ge...
[ "Renders", "Bootstrap", "static", "form", "control", ".", "@param", "array", "$options", "the", "tag", "options", "in", "terms", "of", "name", "-", "value", "pairs", ".", "These", "will", "be", "rendered", "as", "the", "attributes", "of", "the", "resulting",...
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L365-L370
yiisoft/yii2-bootstrap4
src/ActiveField.php
ActiveField.label
public function label($label = null, $options = []) { if (is_bool($label)) { $this->enableLabel = $label; if ($label === false && $this->form->layout === ActiveForm::LAYOUT_HORIZONTAL) { Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']); ...
php
public function label($label = null, $options = []) { if (is_bool($label)) { $this->enableLabel = $label; if ($label === false && $this->form->layout === ActiveForm::LAYOUT_HORIZONTAL) { Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']); ...
[ "public", "function", "label", "(", "$", "label", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_bool", "(", "$", "label", ")", ")", "{", "$", "this", "->", "enableLabel", "=", "$", "label", ";", "if", "(", "$", "labe...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ActiveField.php#L375-L388
yiisoft/yii2-bootstrap4
src/Carousel.php
Carousel.init
public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'carousel', 'slide']); if ($this->crossfade) { Html::addCssClass($this->options, 'carousel-fade'); } }
php
public function init() { parent::init(); Html::addCssClass($this->options, ['widget' => 'carousel', 'slide']); if ($this->crossfade) { Html::addCssClass($this->options, 'carousel-fade'); } }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "Html", "::", "addCssClass", "(", "$", "this", "->", "options", ",", "[", "'widget'", "=>", "'carousel'", ",", "'slide'", "]", ")", ";", "if", "(", "$", "this", "->...
Initializes the widget.
[ "Initializes", "the", "widget", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Carousel.php#L83-L90
yiisoft/yii2-bootstrap4
src/Carousel.php
Carousel.renderIndicators
public function renderIndicators() { if ($this->showIndicators === false) { return ''; } $indicators = []; for ($i = 0, $count = count($this->items); $i < $count; $i++) { $options = ['data-target' => '#' . $this->options['id'], 'data-slide-to' => $i]; ...
php
public function renderIndicators() { if ($this->showIndicators === false) { return ''; } $indicators = []; for ($i = 0, $count = count($this->items); $i < $count; $i++) { $options = ['data-target' => '#' . $this->options['id'], 'data-slide-to' => $i]; ...
[ "public", "function", "renderIndicators", "(", ")", "{", "if", "(", "$", "this", "->", "showIndicators", "===", "false", ")", "{", "return", "''", ";", "}", "$", "indicators", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ",", "$", "count", ...
Renders carousel indicators. @return string the rendering result
[ "Renders", "carousel", "indicators", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Carousel.php#L112-L127
yiisoft/yii2-bootstrap4
src/Carousel.php
Carousel.renderItems
public function renderItems() { $items = []; for ($i = 0, $count = count($this->items); $i < $count; $i++) { $items[] = $this->renderItem($this->items[$i], $i); } return Html::tag('div', implode("\n", $items), ['class' => 'carousel-inner']); }
php
public function renderItems() { $items = []; for ($i = 0, $count = count($this->items); $i < $count; $i++) { $items[] = $this->renderItem($this->items[$i], $i); } return Html::tag('div', implode("\n", $items), ['class' => 'carousel-inner']); }
[ "public", "function", "renderItems", "(", ")", "{", "$", "items", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ",", "$", "count", "=", "count", "(", "$", "this", "->", "items", ")", ";", "$", "i", "<", "$", "count", ";", "$", "i", "+...
Renders carousel items as specified on [[items]]. @return string the rendering result @throws InvalidConfigException
[ "Renders", "carousel", "items", "as", "specified", "on", "[[", "items", "]]", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Carousel.php#L134-L142
yiisoft/yii2-bootstrap4
src/Carousel.php
Carousel.renderItem
public function renderItem($item, $index) { if (is_string($item)) { $content = $item; $caption = null; $options = []; } elseif (isset($item['content'])) { $content = $item['content']; $caption = ArrayHelper::getValue($item, 'caption'); ...
php
public function renderItem($item, $index) { if (is_string($item)) { $content = $item; $caption = null; $options = []; } elseif (isset($item['content'])) { $content = $item['content']; $caption = ArrayHelper::getValue($item, 'caption'); ...
[ "public", "function", "renderItem", "(", "$", "item", ",", "$", "index", ")", "{", "if", "(", "is_string", "(", "$", "item", ")", ")", "{", "$", "content", "=", "$", "item", ";", "$", "caption", "=", "null", ";", "$", "options", "=", "[", "]", ...
Renders a single carousel item @param string|array $item a single item from [[items]] @param int $index the item index as the first item should be set to `active` @return string the rendering result @throws InvalidConfigException if the item is invalid
[ "Renders", "a", "single", "carousel", "item" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Carousel.php#L151-L177
yiisoft/yii2-bootstrap4
src/ToggleButtonGroup.php
ToggleButtonGroup.run
public function run() { if (!isset($this->options['item'])) { $this->options['item'] = [$this, 'renderItem']; } switch ($this->type) { case 'checkbox': if ($this->hasModel()) { return Html::activeCheckboxList($this->model, $this->at...
php
public function run() { if (!isset($this->options['item'])) { $this->options['item'] = [$this, 'renderItem']; } switch ($this->type) { case 'checkbox': if ($this->hasModel()) { return Html::activeCheckboxList($this->model, $this->at...
[ "public", "function", "run", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "'item'", "]", ")", ")", "{", "$", "this", "->", "options", "[", "'item'", "]", "=", "[", "$", "this", ",", "'renderItem'", "]", ";", "...
{@inheritdoc} @throws InvalidConfigException
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ToggleButtonGroup.php#L82-L103
yiisoft/yii2-bootstrap4
src/ToggleButtonGroup.php
ToggleButtonGroup.renderItem
public function renderItem($index, $label, $name, $checked, $value) { $labelOptions = $this->labelOptions; $labelOptions['wrapInput'] = true; Html::addCssClass($labelOptions, 'btn'); if ($checked) { Html::addCssClass($labelOptions, 'active'); } $type = $th...
php
public function renderItem($index, $label, $name, $checked, $value) { $labelOptions = $this->labelOptions; $labelOptions['wrapInput'] = true; Html::addCssClass($labelOptions, 'btn'); if ($checked) { Html::addCssClass($labelOptions, 'active'); } $type = $th...
[ "public", "function", "renderItem", "(", "$", "index", ",", "$", "label", ",", "$", "name", ",", "$", "checked", ",", "$", "value", ")", "{", "$", "labelOptions", "=", "$", "this", "->", "labelOptions", ";", "$", "labelOptions", "[", "'wrapInput'", "]"...
Default callback for checkbox/radio list item rendering. @param int $index item index. @param string $label item label. @param string $name input name. @param bool $checked whether value is checked or not. @param string $value input value. @return string generated HTML. @see Html::checkbox() @see Html::radio()
[ "Default", "callback", "for", "checkbox", "/", "radio", "list", "item", "rendering", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ToggleButtonGroup.php#L116-L134
yiisoft/yii2-bootstrap4
src/ButtonToolbar.php
ButtonToolbar.run
public function run() { BootstrapAsset::register($this->getView()); return Html::tag('div', $this->renderButtonGroups(), $this->options); }
php
public function run() { BootstrapAsset::register($this->getView()); return Html::tag('div', $this->renderButtonGroups(), $this->options); }
[ "public", "function", "run", "(", ")", "{", "BootstrapAsset", "::", "register", "(", "$", "this", "->", "getView", "(", ")", ")", ";", "return", "Html", "::", "tag", "(", "'div'", ",", "$", "this", "->", "renderButtonGroups", "(", ")", ",", "$", "thi...
{@inheritdoc} @throws \Exception
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonToolbar.php#L82-L86
yiisoft/yii2-bootstrap4
src/ButtonToolbar.php
ButtonToolbar.renderButtonGroups
protected function renderButtonGroups() { $buttonGroups = []; foreach ($this->buttonGroups as $group) { if (is_array($group)) { $group['view'] = $this->getView(); if (!isset($group['buttons'])) { continue; } ...
php
protected function renderButtonGroups() { $buttonGroups = []; foreach ($this->buttonGroups as $group) { if (is_array($group)) { $group['view'] = $this->getView(); if (!isset($group['buttons'])) { continue; } ...
[ "protected", "function", "renderButtonGroups", "(", ")", "{", "$", "buttonGroups", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "buttonGroups", "as", "$", "group", ")", "{", "if", "(", "is_array", "(", "$", "group", ")", ")", "{", "$", "gro...
Generates the button groups that compound the toolbar as specified on [[buttonGroups]]. @return string the rendering result. @throws \Exception
[ "Generates", "the", "button", "groups", "that", "compound", "the", "toolbar", "as", "specified", "on", "[[", "buttonGroups", "]]", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/ButtonToolbar.php#L93-L111
yiisoft/yii2-bootstrap4
src/Alert.php
Alert.initOptions
protected function initOptions() { Html::addCssClass($this->options, ['widget' => 'alert']); if ($this->closeButton !== false) { $this->closeButton = array_merge([ 'data-dismiss' => 'alert', 'class' => ['widget' => 'close'], ], $this->closeBut...
php
protected function initOptions() { Html::addCssClass($this->options, ['widget' => 'alert']); if ($this->closeButton !== false) { $this->closeButton = array_merge([ 'data-dismiss' => 'alert', 'class' => ['widget' => 'close'], ], $this->closeBut...
[ "protected", "function", "initOptions", "(", ")", "{", "Html", "::", "addCssClass", "(", "$", "this", "->", "options", ",", "[", "'widget'", "=>", "'alert'", "]", ")", ";", "if", "(", "$", "this", "->", "closeButton", "!==", "false", ")", "{", "$", "...
Initializes the widget options. This method sets the default values for various options.
[ "Initializes", "the", "widget", "options", ".", "This", "method", "sets", "the", "default", "values", "for", "various", "options", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Alert.php#L128-L143
yiisoft/yii2-bootstrap4
src/BootstrapWidgetTrait.php
BootstrapWidgetTrait.registerPlugin
protected function registerPlugin($name) { $view = $this->getView(); BootstrapPluginAsset::register($view); $id = $this->options['id']; if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions); ...
php
protected function registerPlugin($name) { $view = $this->getView(); BootstrapPluginAsset::register($view); $id = $this->options['id']; if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions); ...
[ "protected", "function", "registerPlugin", "(", "$", "name", ")", "{", "$", "view", "=", "$", "this", "->", "getView", "(", ")", ";", "BootstrapPluginAsset", "::", "register", "(", "$", "view", ")", ";", "$", "id", "=", "$", "this", "->", "options", ...
Registers a specific Bootstrap plugin and the related events @param string $name the name of the Bootstrap plugin
[ "Registers", "a", "specific", "Bootstrap", "plugin", "and", "the", "related", "events" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/BootstrapWidgetTrait.php#L68-L83
yiisoft/yii2-bootstrap4
src/Progress.php
Progress.renderProgress
protected function renderProgress() { $out = Html::beginTag('div', $this->options) . "\n"; if (empty($this->bars)) { $this->bars = [ ['label' => $this->label, 'percent' => $this->percent, 'options' => []] ]; } $bars = []; foreach ($this...
php
protected function renderProgress() { $out = Html::beginTag('div', $this->options) . "\n"; if (empty($this->bars)) { $this->bars = [ ['label' => $this->label, 'percent' => $this->percent, 'options' => []] ]; } $bars = []; foreach ($this...
[ "protected", "function", "renderProgress", "(", ")", "{", "$", "out", "=", "Html", "::", "beginTag", "(", "'div'", ",", "$", "this", "->", "options", ")", ".", "\"\\n\"", ";", "if", "(", "empty", "(", "$", "this", "->", "bars", ")", ")", "{", "$", ...
Renders the progress. @return string the rendering result. @throws InvalidConfigException if the "percent" option is not set in a stacked progress bar.
[ "Renders", "the", "progress", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Progress.php#L113-L134
yiisoft/yii2-bootstrap4
src/Progress.php
Progress.renderBar
protected function renderBar($percent, $label = '', $options = []) { $percent = (float)trim(rtrim($percent, '%')); $options = array_merge($options, [ 'role' => 'progressbar', 'aria-valuenow' => $percent, 'aria-valuemin' => 0, 'aria-valuemax' => 100 ...
php
protected function renderBar($percent, $label = '', $options = []) { $percent = (float)trim(rtrim($percent, '%')); $options = array_merge($options, [ 'role' => 'progressbar', 'aria-valuenow' => $percent, 'aria-valuemin' => 0, 'aria-valuemax' => 100 ...
[ "protected", "function", "renderBar", "(", "$", "percent", ",", "$", "label", "=", "''", ",", "$", "options", "=", "[", "]", ")", "{", "$", "percent", "=", "(", "float", ")", "trim", "(", "rtrim", "(", "$", "percent", ",", "'%'", ")", ")", ";", ...
Generates a bar @param int $percent the percentage of the bar @param string $label , optional, the label to display at the bar @param array $options the HTML attributes of the bar @return string the rendering result.
[ "Generates", "a", "bar" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Progress.php#L143-L156
yiisoft/yii2-bootstrap4
src/Tabs.php
Tabs.prepareItems
protected function prepareItems(&$items, $prefix = '') { if (!$this->hasActiveTab()) { $this->activateFirstVisibleTab(); } foreach ($items as $n => $item) { $options = array_merge($this->itemOptions, ArrayHelper::getValue($item, 'options', [])); $options[...
php
protected function prepareItems(&$items, $prefix = '') { if (!$this->hasActiveTab()) { $this->activateFirstVisibleTab(); } foreach ($items as $n => $item) { $options = array_merge($this->itemOptions, ArrayHelper::getValue($item, 'options', [])); $options[...
[ "protected", "function", "prepareItems", "(", "&", "$", "items", ",", "$", "prefix", "=", "''", ")", "{", "if", "(", "!", "$", "this", "->", "hasActiveTab", "(", ")", ")", "{", "$", "this", "->", "activateFirstVisibleTab", "(", ")", ";", "}", "foreac...
Renders tab items as specified on [[items]]. @param array $items @param string $prefix @throws InvalidConfigException
[ "Renders", "tab", "items", "as", "specified", "on", "[[", "items", "]]", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Tabs.php#L171-L215
yiisoft/yii2-bootstrap4
src/Tabs.php
Tabs.activateFirstVisibleTab
protected function activateFirstVisibleTab() { foreach ($this->items as $i => $item) { $active = ArrayHelper::getValue($item, 'active', null); $visible = ArrayHelper::getValue($item, 'visible', true); if ($visible && $active !== false) { $this->items[$i]['...
php
protected function activateFirstVisibleTab() { foreach ($this->items as $i => $item) { $active = ArrayHelper::getValue($item, 'active', null); $visible = ArrayHelper::getValue($item, 'visible', true); if ($visible && $active !== false) { $this->items[$i]['...
[ "protected", "function", "activateFirstVisibleTab", "(", ")", "{", "foreach", "(", "$", "this", "->", "items", "as", "$", "i", "=>", "$", "item", ")", "{", "$", "active", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'active'", ",", "nu...
Sets the first visible tab as active. This method activates the first tab that is visible and not explicitly set to inactive (`'active' => false`).
[ "Sets", "the", "first", "visible", "tab", "as", "active", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Tabs.php#L237-L247
yiisoft/yii2-bootstrap4
src/Tabs.php
Tabs.renderPanes
public function renderPanes($panes) { return $this->renderTabContent ? "\n" . Html::tag('div', implode("\n", $panes), $this->tabContentOptions) : ''; }
php
public function renderPanes($panes) { return $this->renderTabContent ? "\n" . Html::tag('div', implode("\n", $panes), $this->tabContentOptions) : ''; }
[ "public", "function", "renderPanes", "(", "$", "panes", ")", "{", "return", "$", "this", "->", "renderTabContent", "?", "\"\\n\"", ".", "Html", "::", "tag", "(", "'div'", ",", "implode", "(", "\"\\n\"", ",", "$", "panes", ")", ",", "$", "this", "->", ...
Renders tab panes. @param array $panes @return string the rendering result.
[ "Renders", "tab", "panes", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Tabs.php#L255-L258
yiisoft/yii2-bootstrap4
src/BaseHtml.php
BaseHtml.staticControl
public static function staticControl($value, $options = []) { static::addCssClass($options, 'form-control-plaintext'); $value = (string)$value; $options['readonly'] = true; return static::input('text', null, $value, $options); }
php
public static function staticControl($value, $options = []) { static::addCssClass($options, 'form-control-plaintext'); $value = (string)$value; $options['readonly'] = true; return static::input('text', null, $value, $options); }
[ "public", "static", "function", "staticControl", "(", "$", "value", ",", "$", "options", "=", "[", "]", ")", "{", "static", "::", "addCssClass", "(", "$", "options", ",", "'form-control-plaintext'", ")", ";", "$", "value", "=", "(", "string", ")", "$", ...
Renders Bootstrap static form control. @param string $value static control value. @param array $options the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. There are also a special options: @return string generated HTML @see https://getbootstrap.com/docs/4.2/co...
[ "Renders", "Bootstrap", "static", "form", "control", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/BaseHtml.php#L50-L56
yiisoft/yii2-bootstrap4
src/BaseHtml.php
BaseHtml.activeStaticControl
public static function activeStaticControl($model, $attribute, $options = []) { if (isset($options['value'])) { $value = $options['value']; unset($options['value']); } else { $value = static::getAttributeValue($model, $attribute); } return static::...
php
public static function activeStaticControl($model, $attribute, $options = []) { if (isset($options['value'])) { $value = $options['value']; unset($options['value']); } else { $value = static::getAttributeValue($model, $attribute); } return static::...
[ "public", "static", "function", "activeStaticControl", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'value'", "]", ")", ")", "{", "$", "value", "=", "$", "opt...
Generates a Bootstrap static form control for the given model attribute. @param \yii\base\Model $model the model object. @param string $attribute the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression. @param array $options the tag options in terms of name-value pairs. Se...
[ "Generates", "a", "Bootstrap", "static", "form", "control", "for", "the", "given", "model", "attribute", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/BaseHtml.php#L67-L76
yiisoft/yii2-bootstrap4
src/BaseHtml.php
BaseHtml.error
public static function error($model, $attribute, $options = []) { if (!array_key_exists('class', $options)) { $options['class'] = ['invalid-feedback']; } return parent::error($model, $attribute, $options); }
php
public static function error($model, $attribute, $options = []) { if (!array_key_exists('class', $options)) { $options['class'] = ['invalid-feedback']; } return parent::error($model, $attribute, $options); }
[ "public", "static", "function", "error", "(", "$", "model", ",", "$", "attribute", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "array_key_exists", "(", "'class'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'class'", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/BaseHtml.php#L166-L172
yiisoft/yii2-bootstrap4
src/LinkPager.php
LinkPager.run
public function run() { if ($this->registerLinkTags) { $this->registerLinkTags(); } $options = $this->options; $tag = ArrayHelper::remove($options, 'tag', 'nav'); $html = Html::beginTag($tag, $options); $html .= $this->renderPageButtons(); $html .=...
php
public function run() { if ($this->registerLinkTags) { $this->registerLinkTags(); } $options = $this->options; $tag = ArrayHelper::remove($options, 'tag', 'nav'); $html = Html::beginTag($tag, $options); $html .= $this->renderPageButtons(); $html .=...
[ "public", "function", "run", "(", ")", "{", "if", "(", "$", "this", "->", "registerLinkTags", ")", "{", "$", "this", "->", "registerLinkTags", "(", ")", ";", "}", "$", "options", "=", "$", "this", "->", "options", ";", "$", "tag", "=", "ArrayHelper",...
Executes the widget. This overrides the parent implementation by displaying the generated page buttons.
[ "Executes", "the", "widget", ".", "This", "overrides", "the", "parent", "implementation", "by", "displaying", "the", "generated", "page", "buttons", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/LinkPager.php#L148-L160
yiisoft/yii2-bootstrap4
src/Nav.php
Nav.init
public function init() { parent::init(); if ($this->route === null && Yii::$app->controller !== null) { $this->route = Yii::$app->controller->getRoute(); } if ($this->params === null) { $this->params = Yii::$app->request->getQueryParams(); } Ht...
php
public function init() { parent::init(); if ($this->route === null && Yii::$app->controller !== null) { $this->route = Yii::$app->controller->getRoute(); } if ($this->params === null) { $this->params = Yii::$app->request->getQueryParams(); } Ht...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "$", "this", "->", "route", "===", "null", "&&", "Yii", "::", "$", "app", "->", "controller", "!==", "null", ")", "{", "$", "this", "->", "route", "=",...
Initializes the widget.
[ "Initializes", "the", "widget", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Nav.php#L110-L120
yiisoft/yii2-bootstrap4
src/Nav.php
Nav.renderDropdown
protected function renderDropdown($items, $parentItem) { /** @var Widget $dropdownClass */ $dropdownClass = $this->dropdownClass; return $dropdownClass::widget([ 'options' => ArrayHelper::getValue($parentItem, 'dropdownOptions', []), 'items' => $items, 'en...
php
protected function renderDropdown($items, $parentItem) { /** @var Widget $dropdownClass */ $dropdownClass = $this->dropdownClass; return $dropdownClass::widget([ 'options' => ArrayHelper::getValue($parentItem, 'dropdownOptions', []), 'items' => $items, 'en...
[ "protected", "function", "renderDropdown", "(", "$", "items", ",", "$", "parentItem", ")", "{", "/** @var Widget $dropdownClass */", "$", "dropdownClass", "=", "$", "this", "->", "dropdownClass", ";", "return", "$", "dropdownClass", "::", "widget", "(", "[", "'o...
Renders the given items as a dropdown. This method is called to create sub-menus. @param array $items the given items. Please refer to [[Dropdown::items]] for the array structure. @param array $parentItem the parent item information. Please refer to [[items]] for the structure of this array. @return string the renderin...
[ "Renders", "the", "given", "items", "as", "a", "dropdown", ".", "This", "method", "is", "called", "to", "create", "sub", "-", "menus", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Nav.php#L208-L219
yiisoft/yii2-bootstrap4
src/Nav.php
Nav.isChildActive
protected function isChildActive($items, &$active) { foreach ($items as $i => $child) { if (is_array($child) && !ArrayHelper::getValue($child, 'visible', true)) { continue; } if (ArrayHelper::remove($items[$i], 'active', false) || $this->isItemActive($chil...
php
protected function isChildActive($items, &$active) { foreach ($items as $i => $child) { if (is_array($child) && !ArrayHelper::getValue($child, 'visible', true)) { continue; } if (ArrayHelper::remove($items[$i], 'active', false) || $this->isItemActive($chil...
[ "protected", "function", "isChildActive", "(", "$", "items", ",", "&", "$", "active", ")", "{", "foreach", "(", "$", "items", "as", "$", "i", "=>", "$", "child", ")", "{", "if", "(", "is_array", "(", "$", "child", ")", "&&", "!", "ArrayHelper", "::...
Check to see if a child item is active optionally activating the parent. @param array $items @see items @param bool $active should the parent be active too @return array @see items
[ "Check", "to", "see", "if", "a", "child", "item", "is", "active", "optionally", "activating", "the", "parent", "." ]
train
https://github.com/yiisoft/yii2-bootstrap4/blob/0f8b00a67fee75ea8b7ffc4e94d353fb12657d27/src/Nav.php#L227-L250
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.login
public function login($username = 'anonymous', $password = '') { $result = $this->ftp->login($username, $password); if ($result === false) { throw new FtpException('Login incorrect'); } return $this; }
php
public function login($username = 'anonymous', $password = '') { $result = $this->ftp->login($username, $password); if ($result === false) { throw new FtpException('Login incorrect'); } return $this; }
[ "public", "function", "login", "(", "$", "username", "=", "'anonymous'", ",", "$", "password", "=", "''", ")", "{", "$", "result", "=", "$", "this", "->", "ftp", "->", "login", "(", "$", "username", ",", "$", "password", ")", ";", "if", "(", "$", ...
Logs in to an FTP connection. @param string $username @param string $password @return FtpClient @throws FtpException If the login is incorrect
[ "Logs", "in", "to", "an", "FTP", "connection", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L207-L216
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.modifiedTime
public function modifiedTime($remoteFile, $format = null) { $time = $this->ftp->mdtm($remoteFile); if ($time !== -1 && $format !== null) { return date($format, $time); } return $time; }
php
public function modifiedTime($remoteFile, $format = null) { $time = $this->ftp->mdtm($remoteFile); if ($time !== -1 && $format !== null) { return date($format, $time); } return $time; }
[ "public", "function", "modifiedTime", "(", "$", "remoteFile", ",", "$", "format", "=", "null", ")", "{", "$", "time", "=", "$", "this", "->", "ftp", "->", "mdtm", "(", "$", "remoteFile", ")", ";", "if", "(", "$", "time", "!==", "-", "1", "&&", "$...
Returns the last modified time of the given file. Return -1 on error @param string $remoteFile @param string|null $format @return int
[ "Returns", "the", "last", "modified", "time", "of", "the", "given", "file", ".", "Return", "-", "1", "on", "error" ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L227-L236
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.rmdir
public function rmdir($directory, $recursive = true) { if ($recursive) { $files = $this->nlist($directory, false, 'rsort'); // remove children foreach ($files as $file) { $this->remove($file, true); } } // remove the directory...
php
public function rmdir($directory, $recursive = true) { if ($recursive) { $files = $this->nlist($directory, false, 'rsort'); // remove children foreach ($files as $file) { $this->remove($file, true); } } // remove the directory...
[ "public", "function", "rmdir", "(", "$", "directory", ",", "$", "recursive", "=", "true", ")", "{", "if", "(", "$", "recursive", ")", "{", "$", "files", "=", "$", "this", "->", "nlist", "(", "$", "directory", ",", "false", ",", "'rsort'", ")", ";",...
Remove a directory. @see FtpClient::mkdir() @see FtpClient::cleanDir() @see FtpClient::remove() @see FtpClient::delete() @param string $directory @param bool $recursive Forces deletion if the directory is not empty @return bool @throws FtpException If unable to list the directory to remove
[ "Remove", "a", "directory", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L397-L410
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.cleanDir
public function cleanDir($directory) { if (!$files = $this->nlist($directory)) { return $this->isEmpty($directory); } // remove children foreach ($files as $file) { $this->remove($file, true); } return $this->isEmpty($directory); }
php
public function cleanDir($directory) { if (!$files = $this->nlist($directory)) { return $this->isEmpty($directory); } // remove children foreach ($files as $file) { $this->remove($file, true); } return $this->isEmpty($directory); }
[ "public", "function", "cleanDir", "(", "$", "directory", ")", "{", "if", "(", "!", "$", "files", "=", "$", "this", "->", "nlist", "(", "$", "directory", ")", ")", "{", "return", "$", "this", "->", "isEmpty", "(", "$", "directory", ")", ";", "}", ...
Empty directory. @see FtpClient::remove() @see FtpClient::delete() @see FtpClient::rmdir() @param string $directory @return bool
[ "Empty", "directory", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L422-L434
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.remove
public function remove($path, $recursive = false) { try { if (@$this->ftp->delete($path) or ($this->isDir($path) and $this->rmdir($path, $recursive))) { return true; } return false; } catch (\Exception $e) { return false; ...
php
public function remove($path, $recursive = false) { try { if (@$this->ftp->delete($path) or ($this->isDir($path) and $this->rmdir($path, $recursive))) { return true; } return false; } catch (\Exception $e) { return false; ...
[ "public", "function", "remove", "(", "$", "path", ",", "$", "recursive", "=", "false", ")", "{", "try", "{", "if", "(", "@", "$", "this", "->", "ftp", "->", "delete", "(", "$", "path", ")", "or", "(", "$", "this", "->", "isDir", "(", "$", "path...
Remove a file or a directory. @see FtpClient::rmdir() @see FtpClient::cleanDir() @see FtpClient::delete() @param string $path The path of the file or directory to remove @param bool $recursive Is effective only if $path is a directory, {@see FtpClient::rmdir()} @return bool
[ "Remove", "a", "file", "or", "a", "directory", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L446-L458
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.isDir
public function isDir($directory) { $pwd = $this->ftp->pwd(); if ($pwd === false) { throw new FtpException('Unable to resolve the current directory'); } if (@$this->ftp->chdir($directory)) { $this->ftp->chdir($pwd); return true; } ...
php
public function isDir($directory) { $pwd = $this->ftp->pwd(); if ($pwd === false) { throw new FtpException('Unable to resolve the current directory'); } if (@$this->ftp->chdir($directory)) { $this->ftp->chdir($pwd); return true; } ...
[ "public", "function", "isDir", "(", "$", "directory", ")", "{", "$", "pwd", "=", "$", "this", "->", "ftp", "->", "pwd", "(", ")", ";", "if", "(", "$", "pwd", "===", "false", ")", "{", "throw", "new", "FtpException", "(", "'Unable to resolve the current...
Check if a directory exist. @param string $directory @return bool @throws FtpException
[ "Check", "if", "a", "directory", "exist", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L467-L483
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.scanDir
public function scanDir($directory = '.', $recursive = false) { return $this->parseRawList($this->rawlist($directory, $recursive)); }
php
public function scanDir($directory = '.', $recursive = false) { return $this->parseRawList($this->rawlist($directory, $recursive)); }
[ "public", "function", "scanDir", "(", "$", "directory", "=", "'.'", ",", "$", "recursive", "=", "false", ")", "{", "return", "$", "this", "->", "parseRawList", "(", "$", "this", "->", "rawlist", "(", "$", "directory", ",", "$", "recursive", ")", ")", ...
Scan a directory and returns the details of each item. @see FtpClient::nlist() @see FtpClient::rawlist() @see FtpClient::parseRawList() @see FtpClient::dirSize() @param string $directory @param bool $recursive @return array
[ "Scan", "a", "directory", "and", "returns", "the", "details", "of", "each", "item", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L507-L510
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.dirSize
public function dirSize($directory = '.', $recursive = true) { $items = $this->scanDir($directory, $recursive); $size = 0; foreach ($items as $item) { $size += (int) $item['size']; } return $size; }
php
public function dirSize($directory = '.', $recursive = true) { $items = $this->scanDir($directory, $recursive); $size = 0; foreach ($items as $item) { $size += (int) $item['size']; } return $size; }
[ "public", "function", "dirSize", "(", "$", "directory", "=", "'.'", ",", "$", "recursive", "=", "true", ")", "{", "$", "items", "=", "$", "this", "->", "scanDir", "(", "$", "directory", ",", "$", "recursive", ")", ";", "$", "size", "=", "0", ";", ...
Returns the total size of the given directory in bytes. @param string $directory The directory, by default is the current directory. @param bool $recursive true by default @return int The size in bytes.
[ "Returns", "the", "total", "size", "of", "the", "given", "directory", "in", "bytes", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L519-L529
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.count
public function count($directory = '.', $type = null, $recursive = true) { $items = (null === $type ? $this->nlist($directory, $recursive) : $this->scanDir($directory, $recursive)); $count = 0; foreach ($items as $item) { if (null === $type or $item['type'] == $type...
php
public function count($directory = '.', $type = null, $recursive = true) { $items = (null === $type ? $this->nlist($directory, $recursive) : $this->scanDir($directory, $recursive)); $count = 0; foreach ($items as $item) { if (null === $type or $item['type'] == $type...
[ "public", "function", "count", "(", "$", "directory", "=", "'.'", ",", "$", "type", "=", "null", ",", "$", "recursive", "=", "true", ")", "{", "$", "items", "=", "(", "null", "===", "$", "type", "?", "$", "this", "->", "nlist", "(", "$", "directo...
Count the items (file, directory, link, unknown). @param string $directory The directory, by default is the current directory. @param string|null $type The type of item to count (file, directory, link, unknown) @param bool $recursive true by default @return int
[ "Count", "the", "items", "(", "file", "directory", "link", "unknown", ")", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L539-L552
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.getContent
public function getContent($remote_file, $mode = FTP_BINARY, $resumepos = 0) { $handle = fopen('php://temp', 'r+'); if ($this->fget($handle, $remote_file, $mode, $resumepos)) { rewind($handle); return stream_get_contents($handle); } return null; }
php
public function getContent($remote_file, $mode = FTP_BINARY, $resumepos = 0) { $handle = fopen('php://temp', 'r+'); if ($this->fget($handle, $remote_file, $mode, $resumepos)) { rewind($handle); return stream_get_contents($handle); } return null; }
[ "public", "function", "getContent", "(", "$", "remote_file", ",", "$", "mode", "=", "FTP_BINARY", ",", "$", "resumepos", "=", "0", ")", "{", "$", "handle", "=", "fopen", "(", "'php://temp'", ",", "'r+'", ")", ";", "if", "(", "$", "this", "->", "fget"...
Downloads a file from the FTP server into a string @param string $remote_file @param int $mode @param int $resumepos @return string|null
[ "Downloads", "a", "file", "from", "the", "FTP", "server", "into", "a", "string" ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L562-L572
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.putFromString
public function putFromString($remote_file, $content) { $handle = fopen('php://temp', 'w'); fwrite($handle, $content); rewind($handle); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { return $this; } throw new FtpException('Unable to put the ...
php
public function putFromString($remote_file, $content) { $handle = fopen('php://temp', 'w'); fwrite($handle, $content); rewind($handle); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { return $this; } throw new FtpException('Unable to put the ...
[ "public", "function", "putFromString", "(", "$", "remote_file", ",", "$", "content", ")", "{", "$", "handle", "=", "fopen", "(", "'php://temp'", ",", "'w'", ")", ";", "fwrite", "(", "$", "handle", ",", "$", "content", ")", ";", "rewind", "(", "$", "h...
Uploads a file to the server from a string. @param string $remote_file @param string $content @return FtpClient @throws FtpException When the transfer fails
[ "Uploads", "a", "file", "to", "the", "server", "from", "a", "string", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L582-L594
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.putFromPath
public function putFromPath($local_file) { $remote_file = basename($local_file); $handle = fopen($local_file, 'r'); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { rewind($handle); return $this; } throw new FtpException( '...
php
public function putFromPath($local_file) { $remote_file = basename($local_file); $handle = fopen($local_file, 'r'); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { rewind($handle); return $this; } throw new FtpException( '...
[ "public", "function", "putFromPath", "(", "$", "local_file", ")", "{", "$", "remote_file", "=", "basename", "(", "$", "local_file", ")", ";", "$", "handle", "=", "fopen", "(", "$", "local_file", ",", "'r'", ")", ";", "if", "(", "$", "this", "->", "ft...
Uploads a file to the server. @param string $local_file @return FtpClient @throws FtpException When the transfer fails
[ "Uploads", "a", "file", "to", "the", "server", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L603-L616
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.getAll
public function getAll($source_directory, $target_directory, $mode = FTP_BINARY) { if ($source_directory != ".") { if ($this->ftp->chdir($source_directory) == false) { throw new FtpException("Unable to change directory: ".$source_directory); } if (!(is_...
php
public function getAll($source_directory, $target_directory, $mode = FTP_BINARY) { if ($source_directory != ".") { if ($this->ftp->chdir($source_directory) == false) { throw new FtpException("Unable to change directory: ".$source_directory); } if (!(is_...
[ "public", "function", "getAll", "(", "$", "source_directory", ",", "$", "target_directory", ",", "$", "mode", "=", "FTP_BINARY", ")", "{", "if", "(", "$", "source_directory", "!=", "\".\"", ")", "{", "if", "(", "$", "this", "->", "ftp", "->", "chdir", ...
Downloads all files from remote FTP directory @param string $source_directory The remote directory @param string $target_directory The local directory @param int $mode @return FtpClient
[ "Downloads", "all", "files", "from", "remote", "FTP", "directory" ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L672-L700
Nicolab/php-ftp-client
src/FtpClient/FtpClient.php
FtpClient.rawToType
public function rawToType($permission) { if (!is_string($permission)) { throw new FtpException('The "$permission" argument must be a string, "' .gettype($permission).'" given.'); } if (empty($permission[0])) { return 'unknown'; } switch (...
php
public function rawToType($permission) { if (!is_string($permission)) { throw new FtpException('The "$permission" argument must be a string, "' .gettype($permission).'" given.'); } if (empty($permission[0])) { return 'unknown'; } switch (...
[ "public", "function", "rawToType", "(", "$", "permission", ")", "{", "if", "(", "!", "is_string", "(", "$", "permission", ")", ")", "{", "throw", "new", "FtpException", "(", "'The \"$permission\" argument must be a string, \"'", ".", "gettype", "(", "$", "permis...
Convert raw info (drwx---r-x ...) to type (file, directory, link, unknown). Only the first char is used for resolving. @param string $permission Example : drwx---r-x @return string The file type (file, directory, link, unknown) @throws FtpException
[ "Convert", "raw", "info", "(", "drwx", "---", "r", "-", "x", "...", ")", "to", "type", "(", "file", "directory", "link", "unknown", ")", ".", "Only", "the", "first", "char", "is", "used", "for", "resolving", "." ]
train
https://github.com/Nicolab/php-ftp-client/blob/8c66e1104da1b638f5d7a9e24624a5525b459a0c/src/FtpClient/FtpClient.php#L900-L924
seregazhuk/php-pinterest-bot
src/Api/Traits/TryIt.php
TryIt.tryIt
public function tryIt($pinId, $comment, $pathToImage = null) { $data = $this->makeRequest($pinId, $comment, $pathToImage); $this->post(UrlBuilder::RESOURCE_TRY_PIN_CREATE, $data); return $this->getResponse()->getResponseData(); }
php
public function tryIt($pinId, $comment, $pathToImage = null) { $data = $this->makeRequest($pinId, $comment, $pathToImage); $this->post(UrlBuilder::RESOURCE_TRY_PIN_CREATE, $data); return $this->getResponse()->getResponseData(); }
[ "public", "function", "tryIt", "(", "$", "pinId", ",", "$", "comment", ",", "$", "pathToImage", "=", "null", ")", "{", "$", "data", "=", "$", "this", "->", "makeRequest", "(", "$", "pinId", ",", "$", "comment", ",", "$", "pathToImage", ")", ";", "$...
Makes a DidIt activity record. @param string $pinId @param string $comment @param null|string $pathToImage @return array
[ "Makes", "a", "DidIt", "activity", "record", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/TryIt.php#L41-L48
seregazhuk/php-pinterest-bot
src/Api/Traits/TryIt.php
TryIt.tried
public function tried($pinId, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'field_set_key' => 'did_it', 'show_did_it_feed' => true, ]; return $this->getAggregatedActivity($pinId, $data, $limit); }
php
public function tried($pinId, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'field_set_key' => 'did_it', 'show_did_it_feed' => true, ]; return $this->getAggregatedActivity($pinId, $data, $limit); }
[ "public", "function", "tried", "(", "$", "pinId", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "$", "data", "=", "[", "'field_set_key'", "=>", "'did_it'", ",", "'show_did_it_feed'", "=>", "true", ",", "]", ";", "return", "$", "t...
Get the pinners who have tied this pin @param string $pinId @param int $limit @return Pagination
[ "Get", "the", "pinners", "who", "have", "tied", "this", "pin" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/TryIt.php#L72-L80
seregazhuk/php-pinterest-bot
src/Api/Traits/SendsMessages.php
SendsMessages.callSendMessage
protected function callSendMessage($userIds, $emails, array $data) { $userIds = (array)$userIds; $emails = (array)$emails; $this->guardAgainstEmptyData($userIds, $emails); $requestOptions = array_merge( [ 'emails' => $emails, 'user_ids'...
php
protected function callSendMessage($userIds, $emails, array $data) { $userIds = (array)$userIds; $emails = (array)$emails; $this->guardAgainstEmptyData($userIds, $emails); $requestOptions = array_merge( [ 'emails' => $emails, 'user_ids'...
[ "protected", "function", "callSendMessage", "(", "$", "userIds", ",", "$", "emails", ",", "array", "$", "data", ")", "{", "$", "userIds", "=", "(", "array", ")", "$", "userIds", ";", "$", "emails", "=", "(", "array", ")", "$", "emails", ";", "$", "...
@param array|string $userIds @param array|string $emails @param array $data @return bool @throws InvalidRequest
[ "@param", "array|string", "$userIds", "@param", "array|string", "$emails" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/SendsMessages.php#L39-L55
seregazhuk/php-pinterest-bot
src/Api/Traits/SendsMessages.php
SendsMessages.send
public function send($entityId, $text, $userIds, $emails) { $messageData = $this->buildMessageData($text, $entityId); return $this->callSendMessage($userIds, $emails, $messageData); }
php
public function send($entityId, $text, $userIds, $emails) { $messageData = $this->buildMessageData($text, $entityId); return $this->callSendMessage($userIds, $emails, $messageData); }
[ "public", "function", "send", "(", "$", "entityId", ",", "$", "text", ",", "$", "userIds", ",", "$", "emails", ")", "{", "$", "messageData", "=", "$", "this", "->", "buildMessageData", "(", "$", "text", ",", "$", "entityId", ")", ";", "return", "$", ...
Send item with message or by email. @param string $entityId @param string $text @param array|string $userIds @param array|string $emails @return bool @throws InvalidRequest
[ "Send", "item", "with", "message", "or", "by", "email", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/SendsMessages.php#L82-L87
seregazhuk/php-pinterest-bot
src/Api/Providers/Keywords.php
Keywords.recommendedFor
public function recommendedFor($query) { $requestOptions = [ 'scope' => 'pins', 'query' => $query, ]; $result = $this->get(UrlBuilder::RESOURCE_SEARCH, $requestOptions); return empty($result) ? [] : $this->getKeywordsFromRequest($result); }
php
public function recommendedFor($query) { $requestOptions = [ 'scope' => 'pins', 'query' => $query, ]; $result = $this->get(UrlBuilder::RESOURCE_SEARCH, $requestOptions); return empty($result) ? [] : $this->getKeywordsFromRequest($result); }
[ "public", "function", "recommendedFor", "(", "$", "query", ")", "{", "$", "requestOptions", "=", "[", "'scope'", "=>", "'pins'", ",", "'query'", "=>", "$", "query", ",", "]", ";", "$", "result", "=", "$", "this", "->", "get", "(", "UrlBuilder", "::", ...
Get recommendations for query word. @param string $query @return array|bool
[ "Get", "recommendations", "for", "query", "word", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Keywords.php#L16-L26
seregazhuk/php-pinterest-bot
src/Api/Providers/Boards.php
Boards.forUser
public function forUser($username) { $options = [ 'username' => $username, 'field_set_key' => 'detailed', ]; $result = $this->get(UrlBuilder::RESOURCE_GET_BOARDS, $options); return $result ?: []; }
php
public function forUser($username) { $options = [ 'username' => $username, 'field_set_key' => 'detailed', ]; $result = $this->get(UrlBuilder::RESOURCE_GET_BOARDS, $options); return $result ?: []; }
[ "public", "function", "forUser", "(", "$", "username", ")", "{", "$", "options", "=", "[", "'username'", "=>", "$", "username", ",", "'field_set_key'", "=>", "'detailed'", ",", "]", ";", "$", "result", "=", "$", "this", "->", "get", "(", "UrlBuilder", ...
Get boards for user by username. @param string $username @return array
[ "Get", "boards", "for", "user", "by", "username", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Boards.php#L48-L58
seregazhuk/php-pinterest-bot
src/Api/Providers/Boards.php
Boards.info
public function info($username, $board) { $requestOptions = [ 'slug' => $this->formatBoardName($board), 'username' => $username, 'field_set_key' => 'detailed', ]; return $this->get(UrlBuilder::RESOURCE_GET_BOARD, $requestOptions); }
php
public function info($username, $board) { $requestOptions = [ 'slug' => $this->formatBoardName($board), 'username' => $username, 'field_set_key' => 'detailed', ]; return $this->get(UrlBuilder::RESOURCE_GET_BOARD, $requestOptions); }
[ "public", "function", "info", "(", "$", "username", ",", "$", "board", ")", "{", "$", "requestOptions", "=", "[", "'slug'", "=>", "$", "this", "->", "formatBoardName", "(", "$", "board", ")", ",", "'username'", "=>", "$", "username", ",", "'field_set_key...
Get info about user's board. @param string $username @param string $board @return array|bool
[ "Get", "info", "about", "user", "s", "board", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Boards.php#L92-L101
seregazhuk/php-pinterest-bot
src/Api/Providers/Boards.php
Boards.pins
public function pins($boardId, $limit = Pagination::DEFAULT_LIMIT) { return $this->paginate( UrlBuilder::RESOURCE_GET_BOARD_FEED, ['board_id' => $boardId], $limit ); }
php
public function pins($boardId, $limit = Pagination::DEFAULT_LIMIT) { return $this->paginate( UrlBuilder::RESOURCE_GET_BOARD_FEED, ['board_id' => $boardId], $limit ); }
[ "public", "function", "pins", "(", "$", "boardId", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "return", "$", "this", "->", "paginate", "(", "UrlBuilder", "::", "RESOURCE_GET_BOARD_FEED", ",", "[", "'board_id'", "=>", "$", "boardId...
Get pins from board by boardId. @param int $boardId @param int $limit @return Pagination
[ "Get", "pins", "from", "board", "by", "boardId", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Boards.php#L121-L126
seregazhuk/php-pinterest-bot
src/Api/Providers/Boards.php
Boards.update
public function update($boardId, $attributes) { if (isset($attributes['name'])) { $attributes['name'] = $this->formatBoardName($attributes['name']); } $requestOptions = array_merge( [ 'board_id' => $boardId, 'category' => 'other', ...
php
public function update($boardId, $attributes) { if (isset($attributes['name'])) { $attributes['name'] = $this->formatBoardName($attributes['name']); } $requestOptions = array_merge( [ 'board_id' => $boardId, 'category' => 'other', ...
[ "public", "function", "update", "(", "$", "boardId", ",", "$", "attributes", ")", "{", "if", "(", "isset", "(", "$", "attributes", "[", "'name'", "]", ")", ")", "{", "$", "attributes", "[", "'name'", "]", "=", "$", "this", "->", "formatBoardName", "(...
Update board info. Gets boardId and an associative array as params. Available keys of the array are: 'name', 'category', 'description', 'privacy'. - 'privacy' can be 'public' or 'secret'. 'public' by default. - 'category' is 'other' by default. @param $boardId @param $attributes @return mixed
[ "Update", "board", "info", ".", "Gets", "boardId", "and", "an", "associative", "array", "as", "params", ".", "Available", "keys", "of", "the", "array", "are", ":", "name", "category", "description", "privacy", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Boards.php#L139-L153
seregazhuk/php-pinterest-bot
src/Api/Providers/Boards.php
Boards.create
public function create($name, $description, $privacy = self::BOARD_PRIVACY_PUBLIC) { $requestOptions = [ 'name' => $name, 'description' => $description, 'privacy' => $privacy, ]; return $this->post(UrlBuilder::RESOURCE_CREATE_BOARD, $requestOptions); ...
php
public function create($name, $description, $privacy = self::BOARD_PRIVACY_PUBLIC) { $requestOptions = [ 'name' => $name, 'description' => $description, 'privacy' => $privacy, ]; return $this->post(UrlBuilder::RESOURCE_CREATE_BOARD, $requestOptions); ...
[ "public", "function", "create", "(", "$", "name", ",", "$", "description", ",", "$", "privacy", "=", "self", "::", "BOARD_PRIVACY_PUBLIC", ")", "{", "$", "requestOptions", "=", "[", "'name'", "=>", "$", "name", ",", "'description'", "=>", "$", "description...
Create a new board. @param string $name @param string $description @param string $privacy Can be 'public' or 'secret'. 'public' by default. @return bool
[ "Create", "a", "new", "board", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Boards.php#L164-L173
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.create
public function create($imageUrl, $boardId, $description = '', $link = '', $title = '', $sectionId = null) { // Upload image if first argument is a local file if (file_exists($imageUrl)) { $imageUrl = $this->upload($imageUrl); } $requestOptions = [ 'method' =...
php
public function create($imageUrl, $boardId, $description = '', $link = '', $title = '', $sectionId = null) { // Upload image if first argument is a local file if (file_exists($imageUrl)) { $imageUrl = $this->upload($imageUrl); } $requestOptions = [ 'method' =...
[ "public", "function", "create", "(", "$", "imageUrl", ",", "$", "boardId", ",", "$", "description", "=", "''", ",", "$", "link", "=", "''", ",", "$", "title", "=", "''", ",", "$", "sectionId", "=", "null", ")", "{", "// Upload image if first argument is ...
Create a pin. Returns created pin info. @param string $imageUrl @param int $boardId @param string $description @param string $link @param string $title @return array
[ "Create", "a", "pin", ".", "Returns", "created", "pin", "info", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L58-L81
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.edit
public function edit($pindId, $description = '', $link = '', $boardId = null, $title = '', $sectionId = null) { $requestOptions = ['id' => $pindId]; if (!empty($description)) { $requestOptions['description'] = $description; } if (!empty($link)) { $requestOpt...
php
public function edit($pindId, $description = '', $link = '', $boardId = null, $title = '', $sectionId = null) { $requestOptions = ['id' => $pindId]; if (!empty($description)) { $requestOptions['description'] = $description; } if (!empty($link)) { $requestOpt...
[ "public", "function", "edit", "(", "$", "pindId", ",", "$", "description", "=", "''", ",", "$", "link", "=", "''", ",", "$", "boardId", "=", "null", ",", "$", "title", "=", "''", ",", "$", "sectionId", "=", "null", ")", "{", "$", "requestOptions", ...
Edit pin by ID. You can move pin to a new board by setting this board id. @param int $pindId @param string $description @param string $link @param int|null $boardId @param string $title @param int|null $sectionId @return bool
[ "Edit", "pin", "by", "ID", ".", "You", "can", "move", "pin", "to", "a", "new", "board", "by", "setting", "this", "board", "id", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L95-L121
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.repin
public function repin($repinId, $boardId, $description = '') { $requestOptions = [ 'board_id' => $boardId, 'description' => stripslashes($description), 'link' => '', 'is_video' => null, 'pin_id' => $repinId, ]; $t...
php
public function repin($repinId, $boardId, $description = '') { $requestOptions = [ 'board_id' => $boardId, 'description' => stripslashes($description), 'link' => '', 'is_video' => null, 'pin_id' => $repinId, ]; $t...
[ "public", "function", "repin", "(", "$", "repinId", ",", "$", "boardId", ",", "$", "description", "=", "''", ")", "{", "$", "requestOptions", "=", "[", "'board_id'", "=>", "$", "boardId", ",", "'description'", "=>", "stripslashes", "(", "$", "description",...
Make a repin. @param int $repinId @param int $boardId @param string $description @return array
[ "Make", "a", "repin", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L143-L156
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.fromSource
public function fromSource($source, $limit = Pagination::DEFAULT_LIMIT) { $data = ['domain' => $source]; return $this->paginate(UrlBuilder::RESOURCE_DOMAIN_FEED, $data, $limit); }
php
public function fromSource($source, $limit = Pagination::DEFAULT_LIMIT) { $data = ['domain' => $source]; return $this->paginate(UrlBuilder::RESOURCE_DOMAIN_FEED, $data, $limit); }
[ "public", "function", "fromSource", "(", "$", "source", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "$", "data", "=", "[", "'domain'", "=>", "$", "source", "]", ";", "return", "$", "this", "->", "paginate", "(", "UrlBuilder", ...
Get pins from a specific url. For example: https://pinterest.com/source/flickr.com/ will return recent Pins from flickr.com @param string $source @param int $limit @return Pagination
[ "Get", "pins", "from", "a", "specific", "url", ".", "For", "example", ":", "https", ":", "//", "pinterest", ".", "com", "/", "source", "/", "flickr", ".", "com", "/", "will", "return", "recent", "Pins", "from", "flickr", ".", "com" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L182-L187
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.saveOriginalImage
public function saveOriginalImage($pinId, $path) { $pinInfo = $this->info($pinId); if (!isset($pinInfo['images']['orig']['url'])) { return false; } $originalUrl = $pinInfo['images']['orig']['url']; $destination = $path . DIRECTORY_SEPARATOR . basename($originalUr...
php
public function saveOriginalImage($pinId, $path) { $pinInfo = $this->info($pinId); if (!isset($pinInfo['images']['orig']['url'])) { return false; } $originalUrl = $pinInfo['images']['orig']['url']; $destination = $path . DIRECTORY_SEPARATOR . basename($originalUr...
[ "public", "function", "saveOriginalImage", "(", "$", "pinId", ",", "$", "path", ")", "{", "$", "pinInfo", "=", "$", "this", "->", "info", "(", "$", "pinId", ")", ";", "if", "(", "!", "isset", "(", "$", "pinInfo", "[", "'images'", "]", "[", "'orig'"...
Saves the pin original image to the specified path. On success returns full path to saved image. Otherwise returns false. @param string $pinId @param string $path @return false|string
[ "Saves", "the", "pin", "original", "image", "to", "the", "specified", "path", ".", "On", "success", "returns", "full", "path", "to", "saved", "image", ".", "Otherwise", "returns", "false", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L314-L327
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.explore
public function explore($topicId, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'aux_fields' => [], 'prepend' => false, 'offset' => 180, 'section_id' => $topicId, ]; return $this->paginate(UrlBuilder::RESOURCE_EXPLORE_PINS, $data, $li...
php
public function explore($topicId, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'aux_fields' => [], 'prepend' => false, 'offset' => 180, 'section_id' => $topicId, ]; return $this->paginate(UrlBuilder::RESOURCE_EXPLORE_PINS, $data, $li...
[ "public", "function", "explore", "(", "$", "topicId", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "$", "data", "=", "[", "'aux_fields'", "=>", "[", "]", ",", "'prepend'", "=>", "false", ",", "'offset'", "=>", "180", ",", "'se...
Returns trending pins from http://pinterest.com/discover page. Uses topic id, that can be received from $bot->topics->explore() method. @param string $topicId @param int $limit @return Pagination
[ "Returns", "trending", "pins", "from", "http", ":", "//", "pinterest", ".", "com", "/", "discover", "page", ".", "Uses", "topic", "id", "that", "can", "be", "received", "from", "$bot", "-", ">", "topics", "-", ">", "explore", "()", "method", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L351-L361
seregazhuk/php-pinterest-bot
src/Api/Providers/Pins.php
Pins.analytics
public function analytics($pinId) { // Pinterest requires pinId to be a string $pinId = (string)$pinId; return $this->get(UrlBuilder::RESOURCE_PIN_ANALYTICS, ['pin_id' => $pinId]); }
php
public function analytics($pinId) { // Pinterest requires pinId to be a string $pinId = (string)$pinId; return $this->get(UrlBuilder::RESOURCE_PIN_ANALYTICS, ['pin_id' => $pinId]); }
[ "public", "function", "analytics", "(", "$", "pinId", ")", "{", "// Pinterest requires pinId to be a string", "$", "pinId", "=", "(", "string", ")", "$", "pinId", ";", "return", "$", "this", "->", "get", "(", "UrlBuilder", "::", "RESOURCE_PIN_ANALYTICS", ",", ...
Get pin analytics, like numbers of clicks, views and repins @param $pinId @return array|bool|Response
[ "Get", "pin", "analytics", "like", "numbers", "of", "clicks", "views", "and", "repins" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pins.php#L368-L374
seregazhuk/php-pinterest-bot
src/Api/Providers/Auth.php
Auth.login
public function login($username, $password, $autoLogin = true) { if ($this->isLoggedIn()) { return true; } $this->checkCredentials($username, $password); // Trying to load previously saved cookies from last login session for this username. // Then grab user prof...
php
public function login($username, $password, $autoLogin = true) { if ($this->isLoggedIn()) { return true; } $this->checkCredentials($username, $password); // Trying to load previously saved cookies from last login session for this username. // Then grab user prof...
[ "public", "function", "login", "(", "$", "username", ",", "$", "password", ",", "$", "autoLogin", "=", "true", ")", "{", "if", "(", "$", "this", "->", "isLoggedIn", "(", ")", ")", "{", "return", "true", ";", "}", "$", "this", "->", "checkCredentials"...
Login as pinner. @param string $username @param string $password @param bool $autoLogin @return bool
[ "Login", "as", "pinner", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Auth.php#L34-L50
seregazhuk/php-pinterest-bot
src/Api/Providers/Auth.php
Auth.register
public function register($email, $password = null, $name = null, $country = 'GB', $age = 18) { $registrationForm = $this->getRegistrationForm($email, $password, $name, $country, $age); return $this->makeRegisterCall($registrationForm); }
php
public function register($email, $password = null, $name = null, $country = 'GB', $age = 18) { $registrationForm = $this->getRegistrationForm($email, $password, $name, $country, $age); return $this->makeRegisterCall($registrationForm); }
[ "public", "function", "register", "(", "$", "email", ",", "$", "password", "=", "null", ",", "$", "name", "=", "null", ",", "$", "country", "=", "'GB'", ",", "$", "age", "=", "18", ")", "{", "$", "registrationForm", "=", "$", "this", "->", "getRegi...
Register a new user. @param string|Registration $email @param string|null $password @param string|null $name @param string $country @deprecated @param int $age @deprecated @return bool
[ "Register", "a", "new", "user", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Auth.php#L68-L73
seregazhuk/php-pinterest-bot
src/Api/Providers/Auth.php
Auth.registerBusiness
public function registerBusiness($registrationForm, $password = null, $name = null, $website = '') { $registration = $this->register($registrationForm, $password, $name); if (!$registration) { return false; } $website = ($registrationForm instanceof Registration) ? ...
php
public function registerBusiness($registrationForm, $password = null, $name = null, $website = '') { $registration = $this->register($registrationForm, $password, $name); if (!$registration) { return false; } $website = ($registrationForm instanceof Registration) ? ...
[ "public", "function", "registerBusiness", "(", "$", "registrationForm", ",", "$", "password", "=", "null", ",", "$", "name", "=", "null", ",", "$", "website", "=", "''", ")", "{", "$", "registration", "=", "$", "this", "->", "register", "(", "$", "regi...
Register a new business account. At first we register a basic type account. Then convert it to a business one. This is done to receive a confirmation email after registration. @param string|Registration $registrationForm @param string $password @param string $name @param string $website @return bool|mixed
[ "Register", "a", "new", "business", "account", ".", "At", "first", "we", "register", "a", "basic", "type", "account", ".", "Then", "convert", "it", "to", "a", "business", "one", ".", "This", "is", "done", "to", "receive", "a", "confirmation", "email", "a...
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Auth.php#L86-L98
seregazhuk/php-pinterest-bot
src/Api/Providers/Auth.php
Auth.convertToBusiness
public function convertToBusiness($businessName, $websiteUrl = '') { $data = [ 'business_name' => $businessName, 'website_url' => $websiteUrl, 'account_type' => 'other', ]; return $this->post(UrlBuilder::RESOURCE_CONVERT_TO_BUSINESS, $data); }
php
public function convertToBusiness($businessName, $websiteUrl = '') { $data = [ 'business_name' => $businessName, 'website_url' => $websiteUrl, 'account_type' => 'other', ]; return $this->post(UrlBuilder::RESOURCE_CONVERT_TO_BUSINESS, $data); }
[ "public", "function", "convertToBusiness", "(", "$", "businessName", ",", "$", "websiteUrl", "=", "''", ")", "{", "$", "data", "=", "[", "'business_name'", "=>", "$", "businessName", ",", "'website_url'", "=>", "$", "websiteUrl", ",", "'account_type'", "=>", ...
Convert your account to a business one. @param string $businessName @param string $websiteUrl @return bool
[ "Convert", "your", "account", "to", "a", "business", "one", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Auth.php#L107-L116
seregazhuk/php-pinterest-bot
src/Api/Traits/BoardInvites.php
BoardInvites.invites
public function invites() { $data = [ 'current_user' => true, 'field_set_key' => 'news', ]; $invites = $this->get(UrlBuilder::RESOURCE_BOARDS_INVITES, $data); return !$invites ? [] : $invites; }
php
public function invites() { $data = [ 'current_user' => true, 'field_set_key' => 'news', ]; $invites = $this->get(UrlBuilder::RESOURCE_BOARDS_INVITES, $data); return !$invites ? [] : $invites; }
[ "public", "function", "invites", "(", ")", "{", "$", "data", "=", "[", "'current_user'", "=>", "true", ",", "'field_set_key'", "=>", "'news'", ",", "]", ";", "$", "invites", "=", "$", "this", "->", "get", "(", "UrlBuilder", "::", "RESOURCE_BOARDS_INVITES",...
Get boards invites @return array
[ "Get", "boards", "invites" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/BoardInvites.php#L36-L46
seregazhuk/php-pinterest-bot
src/Api/Traits/BoardInvites.php
BoardInvites.invitesFor
public function invitesFor($boardId, $limit = Pagination::DEFAULT_LIMIT) { return $this->paginate( UrlBuilder::RESOURCE_BOARDS_INVITES, ['board_id' => (string) $boardId], $limit ); }
php
public function invitesFor($boardId, $limit = Pagination::DEFAULT_LIMIT) { return $this->paginate( UrlBuilder::RESOURCE_BOARDS_INVITES, ['board_id' => (string) $boardId], $limit ); }
[ "public", "function", "invitesFor", "(", "$", "boardId", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "return", "$", "this", "->", "paginate", "(", "UrlBuilder", "::", "RESOURCE_BOARDS_INVITES", ",", "[", "'board_id'", "=>", "(", "s...
Get invites for a specified board @param string $boardId @param int $limit @return Pagination
[ "Get", "invites", "for", "a", "specified", "board" ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Traits/BoardInvites.php#L55-L60
seregazhuk/php-pinterest-bot
src/Api/Providers/Interests.php
Interests.pins
public function pins($interest, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'feed' => $interest, 'is_category_feed' => true, ]; return $this->paginate(UrlBuilder::RESOURCE_GET_CATEGORY_FEED, $data, $limit); }
php
public function pins($interest, $limit = Pagination::DEFAULT_LIMIT) { $data = [ 'feed' => $interest, 'is_category_feed' => true, ]; return $this->paginate(UrlBuilder::RESOURCE_GET_CATEGORY_FEED, $data, $limit); }
[ "public", "function", "pins", "(", "$", "interest", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "$", "data", "=", "[", "'feed'", "=>", "$", "interest", ",", "'is_category_feed'", "=>", "true", ",", "]", ";", "return", "$", "t...
Returns a feed of pins. @param string $interest @param int $limit @return Pagination
[ "Returns", "a", "feed", "of", "pins", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Interests.php#L51-L59
seregazhuk/php-pinterest-bot
src/Api/Request.php
Request.exec
public function exec($resourceUrl, $postString = '') { $url = UrlBuilder::buildApiUrl($resourceUrl); $headers = $this->getHttpHeaders(); $postString = $this->filePathToUpload ? $this->postFileData : $postString; $result = $this ->httpClient ->execute($url, $p...
php
public function exec($resourceUrl, $postString = '') { $url = UrlBuilder::buildApiUrl($resourceUrl); $headers = $this->getHttpHeaders(); $postString = $this->filePathToUpload ? $this->postFileData : $postString; $result = $this ->httpClient ->execute($url, $p...
[ "public", "function", "exec", "(", "$", "resourceUrl", ",", "$", "postString", "=", "''", ")", "{", "$", "url", "=", "UrlBuilder", "::", "buildApiUrl", "(", "$", "resourceUrl", ")", ";", "$", "headers", "=", "$", "this", "->", "getHttpHeaders", "(", ")...
Executes request to Pinterest API. @param string $resourceUrl @param string $postString @return string
[ "Executes", "request", "to", "Pinterest", "API", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Request.php#L88-L103
seregazhuk/php-pinterest-bot
src/Api/Request.php
Request.autoLogin
public function autoLogin($username) { $this->loadCookiesFor($username); if (!$this->httpClient->cookie('_auth')) { return false; } $this->login(); return true; }
php
public function autoLogin($username) { $this->loadCookiesFor($username); if (!$this->httpClient->cookie('_auth')) { return false; } $this->login(); return true; }
[ "public", "function", "autoLogin", "(", "$", "username", ")", "{", "$", "this", "->", "loadCookiesFor", "(", "$", "username", ")", ";", "if", "(", "!", "$", "this", "->", "httpClient", "->", "cookie", "(", "'_auth'", ")", ")", "{", "return", "false", ...
Load cookies for this username and check if it was logged in. @param string $username @return bool
[ "Load", "cookies", "for", "this", "username", "and", "check", "if", "it", "was", "logged", "in", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Request.php#L143-L154
seregazhuk/php-pinterest-bot
src/Api/Request.php
Request.login
public function login() { $this->setTokenFromCookies(); if (!empty($this->csrfToken)) { $this->loggedIn = true; } return $this; }
php
public function login() { $this->setTokenFromCookies(); if (!empty($this->csrfToken)) { $this->loggedIn = true; } return $this; }
[ "public", "function", "login", "(", ")", "{", "$", "this", "->", "setTokenFromCookies", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "csrfToken", ")", ")", "{", "$", "this", "->", "loggedIn", "=", "true", ";", "}", "return", "$",...
Mark client as logged.
[ "Mark", "client", "as", "logged", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Request.php#L171-L180
seregazhuk/php-pinterest-bot
src/Api/Request.php
Request.createQuery
public function createQuery(array $data = [], array $bookmarks = []) { $data = empty($data) ? [] : $data; $request = $this->createRequestData(['options' => $data], $bookmarks); return UrlBuilder::buildRequestString($request); }
php
public function createQuery(array $data = [], array $bookmarks = []) { $data = empty($data) ? [] : $data; $request = $this->createRequestData(['options' => $data], $bookmarks); return UrlBuilder::buildRequestString($request); }
[ "public", "function", "createQuery", "(", "array", "$", "data", "=", "[", "]", ",", "array", "$", "bookmarks", "=", "[", "]", ")", "{", "$", "data", "=", "empty", "(", "$", "data", ")", "?", "[", "]", ":", "$", "data", ";", "$", "request", "=",...
Create request string. @param array $data @param array|null $bookmarks @return string
[ "Create", "request", "string", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Request.php#L208-L215
seregazhuk/php-pinterest-bot
src/Api/Providers/User.php
User.profile
public function profile($userInfo = null) { // If we call method without params, return current user profile data. if (empty($userInfo)) { return $this->getProfile(); } return $this->updateProfile($userInfo); }
php
public function profile($userInfo = null) { // If we call method without params, return current user profile data. if (empty($userInfo)) { return $this->getProfile(); } return $this->updateProfile($userInfo); }
[ "public", "function", "profile", "(", "$", "userInfo", "=", "null", ")", "{", "// If we call method without params, return current user profile data.", "if", "(", "empty", "(", "$", "userInfo", ")", ")", "{", "return", "$", "this", "->", "getProfile", "(", ")", ...
Updates or returns user profile info. Gets associative array as a param. Available keys of array are: 'last_name', 'first_name', 'username', 'about', 'location' and 'website_url'. You can also change user avatar by passing 'profile_image'. @param array $userInfo If empty returns current user profile. @return bool|arr...
[ "Updates", "or", "returns", "user", "profile", "info", ".", "Gets", "associative", "array", "as", "a", "param", ".", "Available", "keys", "of", "array", "are", ":", "last_name", "first_name", "username", "about", "location", "and", "website_url", ".", "You", ...
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/User.php#L39-L47
seregazhuk/php-pinterest-bot
src/Api/Providers/User.php
User.deactivate
public function deactivate($reason = 'other', $explanation = '') { $userId = $this->id(); if ($userId === null) { return false; } $request = [ 'user_id' => $userId, 'reason' => $reason, 'explanation' => $explanation, ...
php
public function deactivate($reason = 'other', $explanation = '') { $userId = $this->id(); if ($userId === null) { return false; } $request = [ 'user_id' => $userId, 'reason' => $reason, 'explanation' => $explanation, ...
[ "public", "function", "deactivate", "(", "$", "reason", "=", "'other'", ",", "$", "explanation", "=", "''", ")", "{", "$", "userId", "=", "$", "this", "->", "id", "(", ")", ";", "if", "(", "$", "userId", "===", "null", ")", "{", "return", "false", ...
Deactivates your account. @param string $reason @param string $explanation @return bool
[ "Deactivates", "your", "account", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/User.php#L86-L101
seregazhuk/php-pinterest-bot
src/Factories/PinterestBot.php
PinterestBot.create
public static function create() { $request = self::makeRequest(); $response = self::makeResponse(); return self::buildProvidersContainer($request, $response); }
php
public static function create() { $request = self::makeRequest(); $response = self::makeResponse(); return self::buildProvidersContainer($request, $response); }
[ "public", "static", "function", "create", "(", ")", "{", "$", "request", "=", "self", "::", "makeRequest", "(", ")", ";", "$", "response", "=", "self", "::", "makeResponse", "(", ")", ";", "return", "self", "::", "buildProvidersContainer", "(", "$", "req...
Initializes Bot instance and all its dependencies. @return ProvidersContainer
[ "Initializes", "Bot", "instance", "and", "all", "its", "dependencies", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Factories/PinterestBot.php#L18-L24
seregazhuk/php-pinterest-bot
src/Api/Providers/Pinners.php
Pinners.following
public function following($username, $type = UrlBuilder::FOLLOWING_PEOPLE, $limit = Pagination::DEFAULT_LIMIT) { $followingUrl = UrlBuilder::getFollowingUrlByType($type); if ($followingUrl === null) { throw new WrongFollowingType("No following results for $type"); } ret...
php
public function following($username, $type = UrlBuilder::FOLLOWING_PEOPLE, $limit = Pagination::DEFAULT_LIMIT) { $followingUrl = UrlBuilder::getFollowingUrlByType($type); if ($followingUrl === null) { throw new WrongFollowingType("No following results for $type"); } ret...
[ "public", "function", "following", "(", "$", "username", ",", "$", "type", "=", "UrlBuilder", "::", "FOLLOWING_PEOPLE", ",", "$", "limit", "=", "Pagination", "::", "DEFAULT_LIMIT", ")", "{", "$", "followingUrl", "=", "UrlBuilder", "::", "getFollowingUrlByType", ...
Get following info for pinner. @param string $username @param string $type @param int $limit @return Pagination @throws WrongFollowingType
[ "Get", "following", "info", "for", "pinner", "." ]
train
https://github.com/seregazhuk/php-pinterest-bot/blob/0ef279183f998d6b3652f1d4a361ed1e19d04cf1/src/Api/Providers/Pinners.php#L57-L66