code
stringlengths 17
296k
| docstring
stringlengths 30
30.3k
| func_name
stringlengths 1
89
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
153
| url
stringlengths 51
209
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public function store(Store $request)
{
$model = new MetaTag;
$model->fill($request->all());
if ($model->save()) {
session()->flash(config('seo.flash_message'), 'MetaTag saved successfully');
return redirect()->route('seo::meta-tags.index');
} else {
session()->flash(config('seo.flash_error'), 'Something is wrong while saving MetaTag');
}
return redirect()->back();
} | Store a newly created resource in storage.
@return Response | store | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/MetaTagController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/MetaTagController.php | MIT |
public function edit(Edit $request, MetaTag $meta_tag)
{
return view('seo::pages.meta_tags.edit', [
'model' => $meta_tag,
]);
} | Show the form for editing the specified resource.
@return Response | edit | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/MetaTagController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/MetaTagController.php | MIT |
public function update(Update $request, MetaTag $meta_tag)
{
$meta_tag->fill($request->all());
if ($meta_tag->save()) {
session()->flash(config('seo.flash_message'), 'MetaTag successfully updated');
return redirect()->route('seo::meta-tags.index');
} else {
session()->flash(config('seo.flash_error'), 'Something is wrong while updating MetaTag');
}
return redirect()->back();
} | Update a existing resource in storage.
@return Response | update | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/MetaTagController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/MetaTagController.php | MIT |
public function destroy(Destroy $request, MetaTag $meta_tag)
{
if ($meta_tag->delete()) {
session()->flash(config('seo.flash_message'), 'MetaTag successfully deleted');
} else {
session()->flash(config('seo.flash_error'), 'Error occurred while deleting MetaTag');
}
return redirect()->back();
} | Delete a resource from storage.
@return Response
@throws \Exception | destroy | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/MetaTagController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/MetaTagController.php | MIT |
public function index(Index $request, Page $page)
{
return view('seo::pages.images.index', [
'records' => $page->pageImages()->paginate(10),
'page' => $page
]);
} | Display a listing of the resource.
@return Response | index | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function create(Create $request, Page $page)
{
return view('seo::pages.images.create', [
'model' => new PageImage(),
'page' => $page
]);
} | Show the form for creating a new resource.
@return Response | create | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function store(Store $request, Page $page)
{
$model = new PageImage();
$model->fill($request->all());
$model->page_id = $page->id;
if ($model->save()) {
session()->flash(config('seo.flash_message'), 'Image saved successfully');
return redirect()->route('seo::pages.images.index', $page->id);
} else {
session()->flash(config('seo.flash_error'), 'Something is wrong while saving Image');
}
return redirect()->back();
} | Store a newly created resource in storage.
@return Response | store | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function edit(Edit $request, Page $page, PageImage $pageImage)
{
return view('seo::pages.images.edit', [
'model' => $pageImage,
'page' => $page
]);
} | Show the form for editing the specified resource.
@return Response | edit | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function update(Update $request, Page $page, PageImage $pageImage)
{
$pageImage->fill($request->all());
if ($pageImage->save()) {
session()->flash(config('seo.flash_message'), 'Image successfully updated');
return redirect()->route('seo::pages.images.index', $page->id);
} else {
session()->flash(config('seo.flash_error'), 'Something is wrong while updating Image');
}
return redirect()->back();
} | Update a existing resource in storage.
@return Response | update | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function destroy(Destroy $request, Page $page, PageImage $pageImage)
{
if ($pageImage->delete()) {
session()->flash(config('seo.flash_message'), 'Image successfully deleted');
} else {
session()->flash(config('seo.flash_error'), 'Error occurred while deleting Image');
}
return redirect()->back();
} | Delete a resource from storage.
@return Response
@throws \Exception | destroy | php | digitaldreams/laravel-seo-tools | src/Http/Controllers/ImageController.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Controllers/ImageController.php | MIT |
public function fromCache()
{
if (Cache::has($this->url)) {
$this->data = json_decode((string) Cache::get($this->url), true);
} else {
$this->fetch();
}
return $this;
} | Try to get result from cache if exists otherwise run fetch
@return PageAnalysis | fromCache | php | digitaldreams/laravel-seo-tools | src/Services/PageAnalysis.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Services/PageAnalysis.php | MIT |
public function __construct()
{
} | SitemapGeneratorJob constructor. | __construct | php | digitaldreams/laravel-seo-tools | src/Jobs/SitemapGeneratorJob.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Jobs/SitemapGeneratorJob.php | MIT |
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
} | Define the application's command schedule.
@param \Illuminate\Console\Scheduling\Schedule $schedule
@return void | schedule | php | digitaldreams/laravel-seo-tools | src/Console/Kernel.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Console/Kernel.php | MIT |
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
} | Register the commands for the application.
@return void | commands | php | digitaldreams/laravel-seo-tools | src/Console/Kernel.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Console/Kernel.php | MIT |
public function __construct()
{
parent::__construct();
} | Create a new command instance.
@return void | __construct | php | digitaldreams/laravel-seo-tools | src/Console/Commands/Uninstall.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Console/Commands/Uninstall.php | MIT |
public function __construct()
{
parent::__construct();
} | Create a new command instance.
@return void | __construct | php | digitaldreams/laravel-seo-tools | src/Console/Commands/Install.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Console/Commands/Install.php | MIT |
public function edit(User $user, Setting $setting)
{
return false;
} | Determine whether the user can edit the Setting.
@param User $user
@param Setting $setting
@return mixed | edit | php | digitaldreams/laravel-seo-tools | Policies/SettingPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php | MIT |
public function update(User $user, Setting $setting)
{
return false;
} | Determine whether the user can update the Setting.
@param User $user
@param Setting $setting
@return mixed | update | php | digitaldreams/laravel-seo-tools | Policies/SettingPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php | MIT |
public function create(User $user)
{
return true;
} | Determine whether the user can store the Setting.
@param User $user
@param Setting $setting
@return mixed | create | php | digitaldreams/laravel-seo-tools | Policies/SettingPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php | MIT |
public function robotTxt(User $user, Setting $setting)
{
return false;
} | Determine whether the user can robotTxt the Setting.
@param User $user
@param Setting $setting
@return mixed | robotTxt | php | digitaldreams/laravel-seo-tools | Policies/SettingPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php | MIT |
public function htaccess(User $user, Setting $setting)
{
return false;
} | Determine whether the user can htaccess the Setting.
@param User $user
@param Setting $setting
@return mixed | htaccess | php | digitaldreams/laravel-seo-tools | Policies/SettingPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/SettingPolicy.php | MIT |
public function create(User $user)
{
return false;
} | Determine whether the user can create MetaTag.
@param User $user
@return mixed | create | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function store(User $user, MetaTag $metaTag)
{
return false;
} | Determine whether the user can store the MetaTag.
@param User $user
@param MetaTag $metaTag
@return mixed | store | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function edit(User $user, MetaTag $metaTag)
{
return false;
} | Determine whether the user can edit the MetaTag.
@param User $user
@param MetaTag $metaTag
@return mixed | edit | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function update(User $user, MetaTag $metaTag)
{
return false;
} | Determine whether the user can update the MetaTag.
@param User $user
@param MetaTag $metaTag
@return mixed | update | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function global(User $user, MetaTag $metaTag)
{
return false;
} | Determine whether the user can global the MetaTag.
@param User $user
@param MetaTag $metaTag
@return mixed | global | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function delete(User $user, MetaTag $metaTag)
{
return false;
} | Determine whether the user can delete the MetaTag.
@param User $user
@param MetaTag $metaTag
@return mixed | delete | php | digitaldreams/laravel-seo-tools | Policies/MetaTagPolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/MetaTagPolicy.php | MIT |
public function view(User $user, Page $page)
{
return false;
} | Determine whether the user can view the Page.
@param User $user
@param Page $page
@return mixed | view | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function create(User $user)
{
return false;
} | Determine whether the user can create Page.
@param User $user
@return mixed | create | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function store(User $user, Page $page)
{
return false;
} | Determine whether the user can store the Page.
@param User $user
@param Page $page
@return mixed | store | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function edit(User $user, Page $page)
{
return false;
} | Determine whether the user can edit the Page.
@param User $user
@param Page $page
@return mixed | edit | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function update(User $user, Page $page)
{
return false;
} | Determine whether the user can update the Page.
@param User $user
@param Page $page
@return mixed | update | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function bulkUpdate(User $user)
{
return false;
} | Determine whether the user can bulkUpdate the Page.
@param User $user
@param Page $page
@return mixed | bulkUpdate | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function delete(User $user, Page $page)
{
return true;
} | Determine whether the user can delete the Page.
@param User $user
@param Page $page
@return mixed | delete | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function generate(User $user)
{
return true;
} | Determine whether the user can generate the Page.
@param User $user
@param Page $page
@return mixed | generate | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function meta(User $user, Page $page)
{
return true;
} | Determine whether the user can meta the Page.
@param User $user
@param Page $page
@return mixed | meta | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function upload(User $user)
{
return false;
} | Determine whether the user can upload the Page.
@param User $user
@param Page $page
@return mixed | upload | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function download(User $user)
{
return false;
} | Determine whether the user can download the Page.
@param User $user
@param Page $page
@return mixed | download | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function images(User $user, Page $page)
{
return false;
} | Determine whether the user can images the Page.
@param User $user
@param Page $page
@return mixed | images | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function cache(User $user)
{
return true;
} | Determine whether the user can cache the Page.
@param User $user
@param Page $page
@return mixed | cache | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function zip(User $user)
{
return false;
} | Determine whether the user can zip the Page.
@param User $user
@param Page $page
@return mixed | zip | php | digitaldreams/laravel-seo-tools | Policies/PagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/PagePolicy.php | MIT |
public function create(User $user)
{
return false;
} | Determine whether the user can create Image.
@param User $user
@return mixed | create | php | digitaldreams/laravel-seo-tools | Policies/ImagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php | MIT |
public function store(User $user, Image $image)
{
return false;
} | Determine whether the user can store the Image.
@param User $user
@param Image $image
@return mixed | store | php | digitaldreams/laravel-seo-tools | Policies/ImagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php | MIT |
public function edit(User $user, Image $image)
{
return false;
} | Determine whether the user can edit the Image.
@param User $user
@param Image $image
@return mixed | edit | php | digitaldreams/laravel-seo-tools | Policies/ImagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php | MIT |
public function update(User $user, Image $image)
{
return false;
} | Determine whether the user can update the Image.
@param User $user
@param Image $image
@return mixed | update | php | digitaldreams/laravel-seo-tools | Policies/ImagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php | MIT |
public function delete(User $user, Image $image)
{
return false;
} | Determine whether the user can delete the Image.
@param User $user
@param Image $image
@return mixed | delete | php | digitaldreams/laravel-seo-tools | Policies/ImagePolicy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/Policies/ImagePolicy.php | MIT |
public static function defineDirectives()
{
$omitParenthesis = version_compare(app()->version(), '5.3', '<');
self::defineWidgetDirective($omitParenthesis);
self::defineSlotDirectives($omitParenthesis);
} | | ------------------------------------------ |
| Define Blade Directives |
| ------------------------------------------ |
| When you call @ widget from your views |
| The only thing that happens is that the |
| `renderWidget` method Gets called on the |
| `Utils\WidgetRenderer` class |
| ------------------------------------------ |. | defineDirectives | php | imanghafoori1/laravel-widgetize | src/BladeDirective.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/BladeDirective.php | MIT |
public function toHtml()
{
// TODO: Implement toHtml() method.
return '';
} | Get content as a string of HTML.
@return string | toHtml | php | imanghafoori1/laravel-widgetize | src/Widget.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Widget.php | MIT |
public function render()
{
return '';
} | Get the evaluated contents of the object.
@return string | render | php | imanghafoori1/laravel-widgetize | src/Widget.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Widget.php | MIT |
public function boot()
{
$this->_registerDebugbar();
$this->setPublishes();
BladeDirective::defineDirectives();
$this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
} | Bootstrap any application services.
@return void | boot | php | imanghafoori1/laravel-widgetize | src/WidgetsServiceProvider.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/WidgetsServiceProvider.php | MIT |
public function register()
{
$this->mergeConfigFrom(__DIR__.'/config/config.php', 'widgetize');
$this->commands('command.imanghafoori.widget');
app(RouteMacros::class)->registerMacros();
app(SingletonServices::class)->registerSingletons($this->app);
} | Register any application services.
@return void | register | php | imanghafoori1/laravel-widgetize | src/WidgetsServiceProvider.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/WidgetsServiceProvider.php | MIT |
protected function getStub()
{
$stubName = $this->option('plain') ? 'widget_plain' : 'widget';
return __DIR__."/../stubs/$stubName.stub";
} | Get the stub file for the generator.
@return string | getStub | php | imanghafoori1/laravel-widgetize | src/WidgetGenerator.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/WidgetGenerator.php | MIT |
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\\Widgets';
} | Get the default namespace for the class.
@param string $rootNamespace
@return string | getDefaultNamespace | php | imanghafoori1/laravel-widgetize | src/WidgetGenerator.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/WidgetGenerator.php | MIT |
protected function getOptions()
{
return [
['plain', null, InputOption::VALUE_NONE, 'No docs on widget class. No view is being created too.'],
];
} | Get the console command options.
@return array | getOptions | php | imanghafoori1/laravel-widgetize | src/WidgetGenerator.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/WidgetGenerator.php | MIT |
private function setTokenInMemory(string $tag, string $token)
{
return $this->tagTokens[$tag] = $token;
} | Set token in Memory for fast access within the same request.
@param $tag string
@param $token string
@return string | setTokenInMemory | php | imanghafoori1/laravel-widgetize | src/Utils/CacheTag.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/CacheTag.php | MIT |
private function persistToken(string $tag, string $token)
{
Cache::forever('9z10_o6cg_r'.$tag, $token);
} | Save token to disk for later requests.
@param $tag string
@param $token string
@return void | persistToken | php | imanghafoori1/laravel-widgetize | src/Utils/CacheTag.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/CacheTag.php | MIT |
public function startSlot($name)
{
if (ob_start()) {
$this->slotName = $name;
}
} | Start output buffer to get content of slot and set slot name.
@param string $name | startSlot | php | imanghafoori1/laravel-widgetize | src/Utils/SlotRenderer.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php | MIT |
public function renderSlot($data = '')
{
$this->slots[$this->slotName] = $data;
} | get slot content from widget block.
@param string $data | renderSlot | php | imanghafoori1/laravel-widgetize | src/Utils/SlotRenderer.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php | MIT |
public function hasSlots()
{
return ! empty($this->slots);
} | check if widget has any slots.
@return bool | hasSlots | php | imanghafoori1/laravel-widgetize | src/Utils/SlotRenderer.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/SlotRenderer.php | MIT |
private function cacheState()
{
if (! $this->policies->widgetShouldUseCache()) {
return ' 
 Cache: is globally turned off (You should put "enable_cache" => true in config\widgetize.php) ';
}
$l = $this->widget->cacheLifeTime->i ?? 0;
return " 
Cache : {$l} (min) ";
} | Generates a string of current cache configurations.
@return string | cacheState | php | imanghafoori1/laravel-widgetize | src/Utils/DebugInfo.php | https://github.com/imanghafoori1/laravel-widgetize/blob/master/src/Utils/DebugInfo.php | MIT |
public function __construct(callable $callback)
{
$this->callback = $callback;
} | CallbackNameResolver constructor.
@param callable $callback | __construct | php | mark-gerarts/automapper-plus | src/NameResolver/CallbackNameResolver.php | https://github.com/mark-gerarts/automapper-plus/blob/master/src/NameResolver/CallbackNameResolver.php | MIT |
public function __construct(
array $destinationClassList,
array $context = []
) {
$this->destinationClassList = $destinationClassList;
$this->ownContext = $context;
} | MapToAnyOf constructor.
@param string[] $destinationClassList
List of possible destination classes. The first match will be used.
@param array $context
Optional context that will be merged with the parent's context. | __construct | php | mark-gerarts/automapper-plus | src/MappingOperation/Implementations/MapToAnyOf.php | https://github.com/mark-gerarts/automapper-plus/blob/master/src/MappingOperation/Implementations/MapToAnyOf.php | MIT |
public function __construct(
string $destinationClass,
bool $sourceIsObjectArray = false,
array $context = []
) {
$this->destinationClass = $destinationClass;
$this->sourceIsObjectArray = $sourceIsObjectArray;
$this->ownContext = $context;
} | MapTo constructor.
@param string $destinationClass
@param bool $sourceIsObjectArray
Indicates whether or not an array as source value should be treated as
a collection of elements, or as an array representing an object.
@param array
$context Optional context that will be merged with the parent's
context. | __construct | php | mark-gerarts/automapper-plus | src/MappingOperation/Implementations/MapTo.php | https://github.com/mark-gerarts/automapper-plus/blob/master/src/MappingOperation/Implementations/MapTo.php | MIT |
protected function getPrivate($object, string $propertyName)
{
$objectArray = (array) $object;
foreach ($objectArray as $name => $value) {
if (substr($name, - \strlen($propertyName) - 1) === "\x00" . $propertyName) {
return $value;
}
}
return null;
} | Abuses PHP's internal representation of properties when casting an object
to an array.
@param $object
@param string $propertyName
@return mixed | getPrivate | php | mark-gerarts/automapper-plus | src/PropertyAccessor/PropertyAccessor.php | https://github.com/mark-gerarts/automapper-plus/blob/master/src/PropertyAccessor/PropertyAccessor.php | MIT |
public function __construct()
{
$this->path = [];
$this->omit_empty = false;
} | No constructor params are made available in this case as we do not allow customizing how we link
to the parent object. There is only one parent object available, that is the one we are linking to
and that's it. | __construct | php | square/pjson | src/JsonParent.php | https://github.com/square/pjson/blob/master/src/JsonParent.php | Apache-2.0 |
protected function handleMissingValue($data)
{
if ($this->required) {
throw new MissingRequiredPropertyException($this->path, json_encode($data));
}
return null;
} | What happens when deserializing a property that isn't set. | handleMissingValue | php | square/pjson | src/Json.php | https://github.com/square/pjson/blob/master/src/Json.php | Apache-2.0 |
public static function clear()
{
self::$resultCache = array();
self::$compiledCheckerCache = array();
} | Clears the memoization cache once you are done
@return void | clear | php | composer/semver | src/CompilingMatcher.php | https://github.com/composer/semver/blob/master/src/CompilingMatcher.php | MIT |
public static function match(ConstraintInterface $constraint, $operator, $version)
{
$resultCacheKey = $operator.$constraint.';'.$version;
if (isset(self::$resultCache[$resultCacheKey])) {
return self::$resultCache[$resultCacheKey];
}
if (self::$enabled === null) {
self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
}
if (!self::$enabled) {
return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
}
$cacheKey = $operator.$constraint;
if (!isset(self::$compiledCheckerCache[$cacheKey])) {
$code = $constraint->compile($operator);
self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};');
} else {
$function = self::$compiledCheckerCache[$cacheKey];
}
return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
} | Evaluates the expression: $constraint match $operator $version
@param ConstraintInterface $constraint
@param int $operator
@phpstan-param Constraint::OP_* $operator
@param string $version
@return bool | match | php | composer/semver | src/CompilingMatcher.php | https://github.com/composer/semver/blob/master/src/CompilingMatcher.php | MIT |
public static function greaterThan($version1, $version2)
{
return self::compare($version1, '>', $version2);
} | Evaluates the expression: $version1 > $version2.
@param string $version1
@param string $version2
@return bool | greaterThan | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function greaterThanOrEqualTo($version1, $version2)
{
return self::compare($version1, '>=', $version2);
} | Evaluates the expression: $version1 >= $version2.
@param string $version1
@param string $version2
@return bool | greaterThanOrEqualTo | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function lessThan($version1, $version2)
{
return self::compare($version1, '<', $version2);
} | Evaluates the expression: $version1 < $version2.
@param string $version1
@param string $version2
@return bool | lessThan | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function lessThanOrEqualTo($version1, $version2)
{
return self::compare($version1, '<=', $version2);
} | Evaluates the expression: $version1 <= $version2.
@param string $version1
@param string $version2
@return bool | lessThanOrEqualTo | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function equalTo($version1, $version2)
{
return self::compare($version1, '==', $version2);
} | Evaluates the expression: $version1 == $version2.
@param string $version1
@param string $version2
@return bool | equalTo | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function notEqualTo($version1, $version2)
{
return self::compare($version1, '!=', $version2);
} | Evaluates the expression: $version1 != $version2.
@param string $version1
@param string $version2
@return bool | notEqualTo | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function compare($version1, $operator, $version2)
{
$constraint = new Constraint($operator, $version2);
return $constraint->matchSpecific(new Constraint('==', $version1), true);
} | Evaluates the expression: $version1 $operator $version2.
@param string $version1
@param string $operator
@param string $version2
@return bool
@phpstan-param Constraint::STR_OP_* $operator | compare | php | composer/semver | src/Comparator.php | https://github.com/composer/semver/blob/master/src/Comparator.php | MIT |
public static function parseStability($version)
{
$version = (string) preg_replace('{#.+$}', '', (string) $version);
if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
return 'dev';
}
preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
if (!empty($match[3])) {
return 'dev';
}
if (!empty($match[1])) {
if ('beta' === $match[1] || 'b' === $match[1]) {
return 'beta';
}
if ('alpha' === $match[1] || 'a' === $match[1]) {
return 'alpha';
}
if ('rc' === $match[1]) {
return 'RC';
}
}
return 'stable';
} | Returns the stability of a version.
@param string $version
@return string
@phpstan-return 'stable'|'RC'|'beta'|'alpha'|'dev' | parseStability | php | composer/semver | src/VersionParser.php | https://github.com/composer/semver/blob/master/src/VersionParser.php | MIT |
public function parseNumericAliasPrefix($branch)
{
if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) {
return $matches['version'] . '.';
}
return false;
} | Extract numeric prefix from alias, if it is in numeric format, suitable for version comparison.
@param string $branch Branch name (e.g. 2.1.x-dev)
@return string|false Numeric prefix if present (e.g. 2.1.) or false | parseNumericAliasPrefix | php | composer/semver | src/VersionParser.php | https://github.com/composer/semver/blob/master/src/VersionParser.php | MIT |
public function normalizeBranch($name)
{
$name = trim((string) $name);
if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
$version = '';
for ($i = 1; $i < 5; ++$i) {
$version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
}
return str_replace('x', '9999999', $version) . '-dev';
}
return 'dev-' . $name;
} | Normalizes a branch name to be able to perform comparisons on it.
@param string $name
@return string | normalizeBranch | php | composer/semver | src/VersionParser.php | https://github.com/composer/semver/blob/master/src/VersionParser.php | MIT |
public function normalizeDefaultBranch($name)
{
if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') {
return '9999999-dev';
}
return (string) $name;
} | Normalizes a default branch name (i.e. master on git) to 9999999-dev.
@param string $name
@return string
@deprecated No need to use this anymore in theory, Composer 2 does not normalize any branch names to 9999999-dev anymore | normalizeDefaultBranch | php | composer/semver | src/VersionParser.php | https://github.com/composer/semver/blob/master/src/VersionParser.php | MIT |
private function expandStability($stability)
{
$stability = strtolower($stability);
switch ($stability) {
case 'a':
return 'alpha';
case 'b':
return 'beta';
case 'p':
case 'pl':
return 'patch';
case 'rc':
return 'RC';
default:
return $stability;
}
} | Expand shorthand stability string to long version.
@param string $stability
@return string | expandStability | php | composer/semver | src/VersionParser.php | https://github.com/composer/semver/blob/master/src/VersionParser.php | MIT |
public static function clear()
{
self::$intervalsCache = array();
} | Clears the memoization cache once you are done
@return void | clear | php | composer/semver | src/Intervals.php | https://github.com/composer/semver/blob/master/src/Intervals.php | MIT |
public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint)
{
if ($constraint instanceof MatchAllConstraint) {
return true;
}
if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) {
return false;
}
$intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true));
$candidateIntervals = self::get($candidate);
if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) {
return false;
}
foreach ($intersectionIntervals['numeric'] as $index => $interval) {
if (!isset($candidateIntervals['numeric'][$index])) {
return false;
}
if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) {
return false;
}
if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) {
return false;
}
}
if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) {
return false;
}
if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) {
return false;
}
foreach ($intersectionIntervals['branches']['names'] as $index => $name) {
if ($name !== $candidateIntervals['branches']['names'][$index]) {
return false;
}
}
return true;
} | Checks whether $candidate is a subset of $constraint
@return bool | isSubsetOf | php | composer/semver | src/Intervals.php | https://github.com/composer/semver/blob/master/src/Intervals.php | MIT |
public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b)
{
if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) {
return true;
}
if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) {
return false;
}
$intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true);
return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0;
} | Checks whether $a and $b have any intersection, equivalent to $a->matches($b)
@return bool | haveIntersections | php | composer/semver | src/Intervals.php | https://github.com/composer/semver/blob/master/src/Intervals.php | MIT |
public static function satisfies($version, $constraints)
{
if (null === self::$versionParser) {
self::$versionParser = new VersionParser();
}
$versionParser = self::$versionParser;
$provider = new Constraint('==', $versionParser->normalize($version));
$parsedConstraints = $versionParser->parseConstraints($constraints);
return $parsedConstraints->matches($provider);
} | Determine if given version satisfies given constraints.
@param string $version
@param string $constraints
@return bool | satisfies | php | composer/semver | src/Semver.php | https://github.com/composer/semver/blob/master/src/Semver.php | MIT |
public static function rsort(array $versions)
{
return self::usort($versions, self::SORT_DESC);
} | Sort given array of versions in reverse.
@param string[] $versions
@return string[] | rsort | php | composer/semver | src/Semver.php | https://github.com/composer/semver/blob/master/src/Semver.php | MIT |
public function __construct($operator, $version)
{
if (!isset(self::$transOpStr[$operator])) {
throw new \InvalidArgumentException(sprintf(
'Invalid operator "%s" given, expected one of: %s',
$operator,
implode(', ', self::getSupportedOperators())
));
}
$this->operator = self::$transOpStr[$operator];
$this->version = $version;
} | Sets operator and version to compare with.
@param string $operator
@param string $version
@throws \InvalidArgumentException if invalid operator is given.
@phpstan-param self::STR_OP_* $operator | __construct | php | composer/semver | src/Constraint/Constraint.php | https://github.com/composer/semver/blob/master/src/Constraint/Constraint.php | MIT |
public static function getSupportedOperators()
{
return array_keys(self::$transOpStr);
} | Get all supported comparison operators.
@return array
@phpstan-return list<self::STR_OP_*> | getSupportedOperators | php | composer/semver | src/Constraint/Constraint.php | https://github.com/composer/semver/blob/master/src/Constraint/Constraint.php | MIT |
public static function create(array $constraints, $conjunctive = true)
{
if (0 === \count($constraints)) {
return new MatchAllConstraint();
}
if (1 === \count($constraints)) {
return $constraints[0];
}
$optimized = self::optimizeConstraints($constraints, $conjunctive);
if ($optimized !== null) {
list($constraints, $conjunctive) = $optimized;
if (\count($constraints) === 1) {
return $constraints[0];
}
}
return new self($constraints, $conjunctive);
} | Tries to optimize the constraints as much as possible, meaning
reducing/collapsing congruent constraints etc.
Does not necessarily return a MultiConstraint instance if
things can be reduced to a simple constraint
@param ConstraintInterface[] $constraints A set of constraints
@param bool $conjunctive Whether the constraints should be treated as conjunctive or disjunctive
@return ConstraintInterface | create | php | composer/semver | src/Constraint/MultiConstraint.php | https://github.com/composer/semver/blob/master/src/Constraint/MultiConstraint.php | MIT |
public function compareTo(Bound $other, $operator)
{
if (!\in_array($operator, array('<', '>'), true)) {
throw new \InvalidArgumentException('Does not support any other operator other than > or <.');
}
// If they are the same it doesn't matter
if ($this == $other) {
return false;
}
$compareResult = version_compare($this->getVersion(), $other->getVersion());
// Not the same version means we don't need to check if the bounds are inclusive or not
if (0 !== $compareResult) {
return (('>' === $operator) ? 1 : -1) === $compareResult;
}
// Question we're answering here is "am I higher than $other?"
return '>' === $operator ? $other->isInclusive() : !$other->isInclusive();
} | Compares a bound to another with a given operator.
@param Bound $other
@param string $operator
@return bool | compareTo | php | composer/semver | src/Constraint/Bound.php | https://github.com/composer/semver/blob/master/src/Constraint/Bound.php | MIT |
public function toMail($notifiable)
{
return (new MailMessage())
->success()
->subject('::subject-of-notification::')
->line('::notifcation-line::');
} | Get the mail representation of the notification.
@param mixed $notifiable
@return \Illuminate\Notifications\Messages\MailMessage | toMail | php | stefanzweifel/laravel-sends | tests/TestSupport/Notifications/TestNotification.php | https://github.com/stefanzweifel/laravel-sends/blob/master/tests/TestSupport/Notifications/TestNotification.php | MIT |
public function toArray($notifiable)
{
return [
//
];
} | Get the array representation of the notification.
@param mixed $notifiable
@return array | toArray | php | stefanzweifel/laravel-sends | tests/TestSupport/Notifications/TestNotification.php | https://github.com/stefanzweifel/laravel-sends/blob/master/tests/TestSupport/Notifications/TestNotification.php | MIT |
public static function invite($invitationId, $name)
{
$invitation = new self();
// After instantiation of the object we apply the "InvitedEvent".
$invitation->apply(new InvitedEvent($invitationId, $name));
return $invitation;
} | Factory method to create an invitation. | invite | php | broadway/broadway | examples/event-sourced-domain-with-tests/Invites.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php | MIT |
protected function handleInviteCommand(InviteCommand $command)
{
$invitation = Invitation::invite($command->invitationId, $command->name);
$this->repository->save($invitation);
} | A new invite aggregate root is created and added to the repository. | handleInviteCommand | php | broadway/broadway | examples/event-sourced-domain-with-tests/Invites.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php | MIT |
protected function handleAcceptCommand(AcceptCommand $command)
{
$invitation = $this->repository->load($command->invitationId);
$invitation->accept();
$this->repository->save($invitation);
} | An existing invite is loaded from the repository and the accept() method
is called. | handleAcceptCommand | php | broadway/broadway | examples/event-sourced-domain-with-tests/Invites.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-domain-with-tests/Invites.php | MIT |
public static function startLookingForWork($jobSeekerId)
{
$jobSeeker = new self();
// After instantiation of the object we apply the "JobSeekerStartedLookingForWorkEvent".
$jobSeeker->apply(new JobSeekerStartedLookingForWorkEvent($jobSeekerId));
return $jobSeeker;
} | Factory method to create a job seeker. | startLookingForWork | php | broadway/broadway | examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | MIT |
protected function handleJobSeekerStartLookingForWorkCommand(JobSeekerStartLookingForWorkCommand $command)
{
$jobSeeker = JobSeeker::startLookingForWork($command->jobSeekerId);
$this->repository->save($jobSeeker);
} | A new job seeker aggregate root is created and added to the repository. | handleJobSeekerStartLookingForWorkCommand | php | broadway/broadway | examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | MIT |
protected function handleAddJobToJobSeekerCommand(AddJobToJobSeekerCommand $command)
{
$jobSeeker = $this->repository->load($command->jobSeekerId);
$jobSeeker->heldJob($command->jobId, $command->title, $command->description);
$this->repository->save($jobSeeker);
} | An existing job seeker aggregate root is loaded and heldJob() is
called. | handleAddJobToJobSeekerCommand | php | broadway/broadway | examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | MIT |
protected function handleDescribeJobForJobSeekerCommand(DescribeJobForJobSeekerCommand $command)
{
$jobSeeker = $this->repository->load($command->jobSeekerId);
$jobSeeker->describeJob($command->jobId, $command->title, $command->description);
$this->repository->save($jobSeeker);
} | An existing job seeker aggregate root is loaded and describeJob() is
called. | handleDescribeJobForJobSeekerCommand | php | broadway/broadway | examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | MIT |
protected function handleRemoveAccidentallyAddedJobFromJobSeekerCommand(RemoveAccidentallyAddedJobFromJobSeekerCommand $command)
{
$jobSeeker = $this->repository->load($command->jobSeekerId);
$jobSeeker->removeAccidentallyAddedJob($command->jobId);
$this->repository->save($jobSeeker);
} | An existing job seeker aggregate root is loaded and removeAccidentallyAddedJob()
is called. | handleRemoveAccidentallyAddedJobFromJobSeekerCommand | php | broadway/broadway | examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | https://github.com/broadway/broadway/blob/master/examples/event-sourced-multiple-dyanmic-child-entities/JobSeekers.php | MIT |
public function handleExampleCommand(ExampleCommand $command)
{
echo $command->getMessage()."\n";
} | Method handling ExampleCommand commands.
The fact that this method handles the ExampleCommand is signalled by the
convention of the method name: `handle<CommandClassName>`. | handleExampleCommand | php | broadway/broadway | examples/command-handling/command-handling.php | https://github.com/broadway/broadway/blob/master/examples/command-handling/command-handling.php | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.