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 |
---|---|---|---|---|---|---|---|
protected function fixStepArgument($argument)
{
return str_replace('\\"', '"', $argument ?? '');
} | Returns fixed step argument (with \\" replaced back to ").
@param string $argument
@return string | fixStepArgument | php | silverstripe/silverstripe-framework | tests/behat/src/CmsUiContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsUiContext.php | BSD-3-Clause |
protected function findParentByClass(NodeElement $el, $class)
{
$container = $el->getParent();
while ($container && $container->getTagName() != 'body') {
if ($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class') ?? ''))) {
return $container;
}
$container = $container->getParent();
}
return null;
} | Returns the closest parent element having a specific class attribute.
@param NodeElement $el
@param String $class
@return Element|null | findParentByClass | php | silverstripe/silverstripe-framework | tests/behat/src/CmsUiContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsUiContext.php | BSD-3-Clause |
public function __construct($configPath = null)
{
if (empty($configPath)) {
throw new InvalidArgumentException("filesPath is required");
}
$this->setConfigPath($configPath);
} | Create new ConfigContext
@param string $configPath Path to config files. E.g.
`%paths.modules.framework%/tests/behat/features/configs/` | __construct | php | silverstripe/silverstripe-framework | tests/behat/src/ConfigContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/ConfigContext.php | BSD-3-Clause |
public function afterResetAssets(AfterScenarioScope $event)
{
// No files to cleanup
if (empty($this->activatedConfigFiles)) {
return;
}
foreach ($this->activatedConfigFiles as $configFile) {
if (file_exists($configFile ?? '')) {
unlink($configFile ?? '');
}
}
$this->activatedConfigFiles = [];
// Flush
$this->stepIFlush();
} | Clean up all files after scenario
@AfterScenario
@param AfterScenarioScope $event | afterResetAssets | php | silverstripe/silverstripe-framework | tests/behat/src/ConfigContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/ConfigContext.php | BSD-3-Clause |
public function stepIHaveConfigFile($filename)
{
// Ensure site is in dev mode
/** @var Kernel $kernel */
$kernel = Injector::inst()->get(Kernel::class);
Assert::assertEquals(Kernel::DEV, $kernel->getEnvironment(), "Site is in dev mode");
// Ensure file exists in specified fixture dir
$sourceDir = $this->getConfigPath();
$sourcePath = "{$sourceDir}/{$filename}";
Assert::assertFileExists($sourcePath, "Config file {$filename} exists");
// Get destination
$project = ModuleManifest::config()->get('project') ?: 'mysite';
$mysite = ModuleLoader::getModule($project);
Assert::assertNotNull($mysite, 'Project exists');
$destPath = $mysite->getResource("_config/{$filename}")->getPath();
Assert::assertFileDoesNotExist($destPath, "Config file {$filename} hasn't already been loaded");
// Load
$this->activatedConfigFiles[] = $destPath;
copy($sourcePath ?? '', $destPath ?? '');
// Flush website
$this->stepIFlush();
} | Setup a config file. The $filename should be a yml filename
placed in the directory specified by configPaths argument
to fixture constructor.
@When /^(?:|I )have a config file "([^"]+)"$/
@param string $filename | stepIHaveConfigFile | php | silverstripe/silverstripe-framework | tests/behat/src/ConfigContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/ConfigContext.php | BSD-3-Clause |
public function getSession($name = null)
{
return $this->getMainContext()->getSession($name);
} | Get Mink session from MinkContext
@param string $name
@return Session | getSession | php | silverstripe/silverstripe-framework | tests/behat/src/CmsFormsContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsFormsContext.php | BSD-3-Clause |
public function stepContentInHtmlFieldShouldHaveFormatting($text, $field, $negate, $formatting) {
$inputField = $this->getHtmlField($field);
$crawler = new Crawler($inputField->getValue());
$matchedNode = null;
foreach($crawler->filterXPath('//*') as $node) {
if(
$node->firstChild
&& $node->firstChild->nodeType == XML_TEXT_NODE
&& stripos($node->firstChild->nodeValue ?? '', $text ?? '') !== FALSE
) {
$matchedNode = $node;
}
}
Assert::assertNotNull($matchedNode);
if ($formatting == 'bold') {
if ($negate) {
Assert::assertNotEquals('strong', $matchedNode->nodeName);
} else {
Assert::assertEquals('strong', $matchedNode->nodeName);
}
} else if ($formatting == 'left aligned') {
if ($matchedNode->getAttribute('class')) {
if ($negate) {
Assert::assertNotEquals('text-left', $matchedNode->getAttribute('class'));
} else {
Assert::assertEquals('text-left', $matchedNode->getAttribute('class'));
}
}
} else if ($formatting == 'right aligned') {
if ($negate) {
Assert::assertNotEquals('text-right', $matchedNode->getAttribute('class'));
} else {
Assert::assertEquals('text-right', $matchedNode->getAttribute('class'));
}
}
} | Checks formatting in the HTML field, by analyzing the HTML node surrounding
the text for certain properties.
Example: Given "my text" in the "Content" HTML field should be right aligned
Example: Given "my text" in the "Content" HTML field should not be bold
@Given /^"(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field should(?P<negate>(?: not)?) be (?P<formatting>(.*))$/ | stepContentInHtmlFieldShouldHaveFormatting | php | silverstripe/silverstripe-framework | tests/behat/src/CmsFormsContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsFormsContext.php | BSD-3-Clause |
public function stepIHighlightTextInHtmlField($text, $field)
{
$inputField = $this->getHtmlField($field);
$inputFieldId = $inputField->getAttribute('id');
$text = addcslashes($text ?? '', "'");
$js = <<<JS
var editor = jQuery('#$inputFieldId').entwine('ss').getEditor(),
doc = editor.getInstance().getDoc(),
sel = editor.getInstance().selection,
rng = document.createRange(),
matched = false;
editor.getInstance().focus();
jQuery(doc).find('body *').each(function() {
if(!matched) {
for(var i=0;i<this.childNodes.length;i++) {
if(!matched && this.childNodes[i].nodeValue && this.childNodes[i].nodeValue.match('$text')) {
rng.setStart(this.childNodes[i], this.childNodes[i].nodeValue.indexOf('$text'));
rng.setEnd(this.childNodes[i], this.childNodes[i].nodeValue.indexOf('$text') + '$text'.length);
sel.setRng(rng);
editor.getInstance().nodeChanged();
matched = true;
break;
}
}
}
});
JS;
$this->getSession()->executeScript($js);
} | Selects the first textual match in the HTML editor. Does not support
selection across DOM node boundaries.
@When /^I select "(?P<text>([^"]*))" in the "(?P<field>(?:[^"]|\\")*)" HTML field$/ | stepIHighlightTextInHtmlField | php | silverstripe/silverstripe-framework | tests/behat/src/CmsFormsContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsFormsContext.php | BSD-3-Clause |
public function iClickOnTheHtmlFieldButton($button)
{
$xpath = "//*[@aria-label='" . $button . "']";
$session = $this->getSession();
$element = $session->getPage()->find('xpath', $xpath);
if (null === $element) {
// If it can't find the exact name, find one that starts with the phrase
// Helpful for "Insert link" which has a conditional label for keyboard shortcut
$xpath = "//*[starts-with(@aria-label, '" . $button . "')]";
$element = $session->getPage()->find('xpath', $xpath);
if (null === $element) {
throw new \InvalidArgumentException(sprintf('Could not find element with xpath %s', $xpath));
};
}
$element->click();
} | Click on the element with the provided CSS Selector
@When /^I press the "([^"]*)" HTML field button$/ | iClickOnTheHtmlFieldButton | php | silverstripe/silverstripe-framework | tests/behat/src/CmsFormsContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsFormsContext.php | BSD-3-Clause |
protected function getGridFieldButton($gridFieldName, $rowName, $buttonLabel)
{
$page = $this->getSession()->getPage();
$gridField = $page->find('xpath', sprintf('//*[@data-name="%s"]', $gridFieldName));
Assert::assertNotNull($gridField, sprintf('Gridfield "%s" not found', $gridFieldName));
$name = $gridField->find('xpath', sprintf('//*[count(*)=0 and contains(.,"%s")]', $rowName));
if (!$name) {
return null;
}
if ($dropdownButton = $name->getParent()->find('css', '.action-menu__toggle')) {
$dropdownButton->click();
}
$button = $name->getParent()->find('named', ['link_or_button', $buttonLabel]);
return $button;
} | Finds a button in the gridfield row
@param $gridFieldName
@param $rowName
@param $buttonLabel
@return $button | getGridFieldButton | php | silverstripe/silverstripe-framework | tests/behat/src/CmsFormsContext.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/behat/src/CmsFormsContext.php | BSD-3-Clause |
protected function getStubFormWithWeirdValueFormat()
{
return new Form(
Controller::curr(),
'Form',
new FieldList(
$dateField = DatetimeField::create('SomeDateTimeField')
->setHTML5(false)
->setDatetimeFormat("EEE, MMM d, ''yy HH:mm:ss"),
$timeField = TimeField::create('SomeTimeField')
->setHTML5(false)
->setTimeFormat("hh 'o''clock' a mm ss") // Swatch Internet Time format
),
new FieldList()
);
} | Some fields handle submitted values differently from their internal values. This forms contains 2 such fields
* a SomeDateTimeField that expect a date such as `Fri, Jun 15, '18 17:28:05`,
* a SomeTimeField that expects it's time as `05 o'clock PM 28 05`
@return Form | getStubFormWithWeirdValueFormat | php | silverstripe/silverstripe-framework | tests/php/Forms/FormTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/FormTest.php | BSD-3-Clause |
protected function clean($input)
{
return str_replace(
[
html_entity_decode(' ', 0, 'UTF-8'),
html_entity_decode(' ', 0, 'UTF-8'), // narrow non-breaking space
],
' ',
trim($input ?? '')
);
} | In some cases and locales, validation expects non-breaking spaces.
This homogenises narrow and regular NBSPs to a regular space character
@param string $input
@return string The input value, with all non-breaking spaces replaced with spaces | clean | php | silverstripe/silverstripe-framework | tests/php/Forms/FormTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/FormTest.php | BSD-3-Clause |
public function createDropdownField($emptyString = null, $value = '')
{
/* Set up source, with 0 and 1 integers as the values */
$source = [
0 => 'No',
1 => 'Yes'
];
$field = new DropdownField('Field', null, $source, $value);
if ($emptyString !== null) {
$field->setEmptyString($emptyString);
}
return $field;
} | Create a test dropdown field, with the option to
set what source and blank value it should contain
as optional parameters.
@param string|null $emptyString The text to display for the empty value
@param string|integer $value The default value of the field
@return DropdownField object | createDropdownField | php | silverstripe/silverstripe-framework | tests/php/Forms/DropdownFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/DropdownFieldTest.php | BSD-3-Clause |
public function findOptionElements($html)
{
$parser = new CSSContentParser($html);
return $parser->getBySelector('option');
} | Find all the <OPTION> elements from a
string of HTML.
@param string $html HTML to scan for elements
@return SimpleXMLElement | findOptionElements | php | silverstripe/silverstripe-framework | tests/php/Forms/DropdownFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/DropdownFieldTest.php | BSD-3-Clause |
public function escapeHtmlDataProvider()
{
return [
['<html>'],
[['<html>']],
[['<html>' => '<html>']]
];
} | Covering all potential inputs for Convert::raw2xml | escapeHtmlDataProvider | php | silverstripe/silverstripe-framework | tests/php/Forms/FormFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/FormFieldTest.php | BSD-3-Clause |
protected function buildFormMock()
{
$form = $this->createMock(Form::class);
$form->method('getTemplateHelper')
->willReturn(FormTemplateHelper::singleton());
$form->method('getHTMLID')
->willReturn($this->formId);
return $form;
} | Build a new mock object of a Form
@return Form | buildFormMock | php | silverstripe/silverstripe-framework | tests/php/Forms/TreeMultiselectFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/TreeMultiselectFieldTest.php | BSD-3-Clause |
protected function buildField(Form $form)
{
$field = new TreeMultiselectField($this->fieldName, 'Test tree', File::class);
$field->setForm($form);
return $field;
} | Build a new instance of TreeMultiselectField
@param Form $form The field form
@return TreeMultiselectField | buildField | php | silverstripe/silverstripe-framework | tests/php/Forms/TreeMultiselectFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/TreeMultiselectFieldTest.php | BSD-3-Clause |
protected function loadFolders()
{
$asdf = $this->objFromFixture(File::class, 'asdf');
$subfolderfile1 = $this->objFromFixture(File::class, 'subfolderfile1');
return [$asdf, $subfolderfile1];
} | Load several files from the fixtures and return them in an array
@return File[] | loadFolders | php | silverstripe/silverstripe-framework | tests/php/Forms/TreeMultiselectFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/TreeMultiselectFieldTest.php | BSD-3-Clause |
private function assertFieldAttributes(SudoModePasswordField $field, array $expected)
{
$keys = array_keys($expected);
$actual = array_filter($field->getAttributes(), fn($key) => in_array($key, $keys), ARRAY_FILTER_USE_KEY);
$this->assertSame($expected, $actual);
} | Used to test a subset of attributes as things like 'disabled' and 'readonly' are not applicable | assertFieldAttributes | php | silverstripe/silverstripe-framework | tests/php/Forms/SudoModePasswordFieldTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/SudoModePasswordFieldTest.php | BSD-3-Clause |
private function getHeaderlessGridField()
{
$this->gridField->setRequest(new HTTPRequest('GET', 'admin/pages/edit/show/9999'));
$fieldList = FieldList::create(new TabSet('Root', new Tab('Main')));
$fieldList->addFieldToTab('Root.GridField', $this->gridField);
Form::create(null, 'Form', $fieldList, FieldList::create());
return $this->gridField;
} | This GridField will be lazy because it doesn't have a `X-Pjax` header.
@return GridField | getHeaderlessGridField | php | silverstripe/silverstripe-framework | tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | BSD-3-Clause |
private function getOutOfTabSetGridField()
{
$r = new HTTPRequest('POST', 'admin/pages/edit/EditForm/9999/field/testfield');
$r->addHeader('X-Pjax', 'CurrentField');
$this->gridField->setRequest($r);
$fieldList = new FieldList($this->gridField);
Form::create(null, 'Form', $fieldList, FieldList::create());
return $this->gridField;
} | This GridField will not be lazy because it's in not in a tab set.
@return GridField | getOutOfTabSetGridField | php | silverstripe/silverstripe-framework | tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | BSD-3-Clause |
private function getNonLazyGridField()
{
$r = new HTTPRequest('POST', 'admin/pages/edit/EditForm/9999/field/testfield');
$r->addHeader('X-Pjax', 'CurrentField');
$this->gridField->setRequest($r);
$fieldList = new FieldList(new TabSet('Root', new Tab('Main')));
$fieldList->addFieldToTab('Root', $this->gridField);
Form::create(null, 'Form', $fieldList, FieldList::create());
return $this->gridField;
} | This gridfield will not be lazy, because it has `X-Pjax` header equal to `CurrentField`
@return GridField | getNonLazyGridField | php | silverstripe/silverstripe-framework | tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | BSD-3-Clause |
private function makeGridFieldReadonly(GridField $gridField)
{
$form = $gridField->getForm()->makeReadonly();
$fields = $form->Fields()->dataFields();
foreach ($fields as $field) {
if ($field->getName() === 'testfield') {
return $field;
}
}
} | Perform a readonly transformation on our GridField's Form and return the ReadOnly GridField.
We need to make sure the LazyLoader component still works after our GridField has been made readonly.
@param GridField $gridField
@return GridField | makeGridFieldReadonly | php | silverstripe/silverstripe-framework | tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | BSD-3-Clause |
public function updateFormFields(FieldList &$fields, Controller $controller, $name, $context = [])
{
// Add preview link
if (empty($context['Record'])) {
return;
}
/** @var Versioned|DataObject $record */
$record = $context['Record'];
if ($record->hasExtension(Versioned::class) && $record->hasStages()) {
$link = $controller->Link('preview');
$fields->unshift(
new LiteralField(
"PreviewLink",
sprintf('<a href="%s" rel="external" target="_blank">Preview</a>', Convert::raw2att($link))
)
);
}
} | Adds extra fields to this form
@param FieldList $fields
@param Controller $controller
@param string $name
@param array $context | updateFormFields | php | silverstripe/silverstripe-framework | tests/php/Forms/FormFactoryTest/ControllerExtension.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Forms/FormFactoryTest/ControllerExtension.php | BSD-3-Clause |
protected function expectExceptionRedirect($url)
{
$this->expectedRedirect = $url;
} | Expects this test to throw a HTTPResponse_Exception with the given redirect
@param string $url | expectExceptionRedirect | php | silverstripe/silverstripe-framework | tests/php/Control/DirectorTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Control/DirectorTest.php | BSD-3-Clause |
public function onBeforeHTTPError()
{
ControllerExtension::$called_error = true;
} | Called whenever there is an HTTP error | onBeforeHTTPError | php | silverstripe/silverstripe-framework | tests/php/Control/RequestHandlingTest/ControllerExtension.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Control/RequestHandlingTest/ControllerExtension.php | BSD-3-Clause |
public function onBeforeHTTPError404()
{
ControllerExtension::$called_404_error = true;
} | Called whenever there is an 404 error | onBeforeHTTPError404 | php | silverstripe/silverstripe-framework | tests/php/Control/RequestHandlingTest/ControllerExtension.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Control/RequestHandlingTest/ControllerExtension.php | BSD-3-Clause |
public function formaction($data, $form = null)
{
return 'formaction';
} | @param array $data
@param Form $form Made optional to simulate error behaviour in "live" environment (missing arguments don't throw a fatal error there)
(missing arguments don't throw a fatal error there)
@return string | formaction | php | silverstripe/silverstripe-framework | tests/php/Control/RequestHandlingTest/FormActionController.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Control/RequestHandlingTest/FormActionController.php | BSD-3-Clause |
protected function assertEqualsQuoted($expected, $actual)
{
$message = sprintf(
'Expected "%s" but given "%s"',
addcslashes($expected ?? '', "\r\n"),
addcslashes($actual ?? '', "\r\n")
);
$this->assertEquals($expected, $actual, $message);
} | Helper function for comparing characters with significant whitespaces
@param string $expected
@param string $actual | assertEqualsQuoted | php | silverstripe/silverstripe-framework | tests/php/Core/ConvertTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Core/ConvertTest.php | BSD-3-Clause |
public function assertFinderFinds(ManifestFileFinder $finder, $base, $expect, $message = '')
{
if (!$base) {
$base = $this->defaultBase;
}
$found = $finder->find($base);
foreach ($expect as $k => $file) {
$expect[$k] = "{$base}/$file";
}
sort($expect);
sort($found);
$this->assertEquals($expect, $found, $message);
} | Test that the finder can find the given files
@param ManifestFileFinder $finder
@param string $base
@param array $expect
@param string $message | assertFinderFinds | php | silverstripe/silverstripe-framework | tests/php/Core/Manifest/ManifestFileFinderTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Core/Manifest/ManifestFileFinderTest.php | BSD-3-Clause |
protected function getConfigFixtureValue($name)
{
return $this->getTestConfig()->get(__CLASS__, $name);
} | This is a helper method for getting a new manifest
@param string $name
@return mixed | getConfigFixtureValue | php | silverstripe/silverstripe-framework | tests/php/Core/Manifest/ConfigManifestTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Core/Manifest/ConfigManifestTest.php | BSD-3-Clause |
public function getTestConfig()
{
$config = new MemoryConfigCollection();
$factory = new CoreConfigFactory();
$transformer = $factory->buildYamlTransformerForPath(dirname(__FILE__) . '/fixtures/configmanifest');
$config->transform([$transformer]);
return $config;
} | Build a new config based on YMl manifest
@return MemoryConfigCollection | getTestConfig | php | silverstripe/silverstripe-framework | tests/php/Core/Manifest/ConfigManifestTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Core/Manifest/ConfigManifestTest.php | BSD-3-Clause |
protected function getParsedAsMessage($path)
{
return sprintf('Reference path "%s" failed to parse correctly', $path);
} | This is a helper method for displaying a relevant message about a parsing failure
@param string $path
@return string | getParsedAsMessage | php | silverstripe/silverstripe-framework | tests/php/Core/Manifest/ConfigManifestTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Core/Manifest/ConfigManifestTest.php | BSD-3-Clause |
public function render($templateString, $data = null, $cacheTemplate = false)
{
$t = SSViewer::fromString($templateString, $cacheTemplate);
if (!$data) {
$data = new SSViewerTest\TestFixture();
}
return trim('' . $t->process($data));
} | Small helper to render templates from strings
@param string $templateString
@param null $data
@param bool $cacheTemplate
@return string | render | php | silverstripe/silverstripe-framework | tests/php/View/SSViewerTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/SSViewerTest.php | BSD-3-Clause |
protected function setupCombinedRequirements($backend)
{
$this->setupRequirements($backend);
// require files normally (e.g. called from a FormField instance)
$backend->javascript('javascript/RequirementsTest_a.js');
$backend->javascript('javascript/RequirementsTest_b.js');
$backend->javascript('javascript/RequirementsTest_c.js');
// Public resources may or may not be specified with `public/` prefix
$backend->javascript('javascript/RequirementsTest_d.js');
$backend->javascript('public/javascript/RequirementsTest_e.js');
// require two of those files as combined includes
$backend->combineFiles(
'RequirementsTest_bc.js',
[
'javascript/RequirementsTest_b.js',
'javascript/RequirementsTest_c.js'
]
);
} | Setup combined and non-combined js with the backend
@param Requirements_Backend $backend | setupCombinedRequirements | php | silverstripe/silverstripe-framework | tests/php/View/RequirementsTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/RequirementsTest.php | BSD-3-Clause |
protected function setupCombinedNonrequiredRequirements($backend)
{
$this->setupRequirements($backend);
// require files as combined includes
$backend->combineFiles(
'RequirementsTest_bc.js',
[
'javascript/RequirementsTest_b.js',
'javascript/RequirementsTest_c.js'
]
);
} | Setup combined files with the backend
@param Requirements_Backend $backend | setupCombinedNonrequiredRequirements | php | silverstripe/silverstripe-framework | tests/php/View/RequirementsTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/RequirementsTest.php | BSD-3-Clause |
public function assertFileIncluded($backend, $type, $files)
{
$includedFiles = $this->getBackendFiles($backend, $type);
if (is_array($files)) {
$failedMatches = [];
foreach ($files as $file) {
if (!array_key_exists($file, $includedFiles ?? [])) {
$failedMatches[] = $file;
}
}
$this->assertCount(
0,
$failedMatches,
"Failed asserting the $type files '"
. implode("', '", $failedMatches)
. "' have exact matches in the required elements:\n'"
. implode("'\n'", array_keys($includedFiles ?? [])) . "'"
);
} else {
$this->assertArrayHasKey(
$files,
$includedFiles,
"Failed asserting the $type file '$files' has an exact match in the required elements:\n'"
. implode("'\n'", array_keys($includedFiles ?? [])) . "'"
);
}
} | Verify that the given backend includes the given files
@param Requirements_Backend $backend
@param string $type js or css
@param array|string $files Files or list of files to check | assertFileIncluded | php | silverstripe/silverstripe-framework | tests/php/View/RequirementsTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/RequirementsTest.php | BSD-3-Clause |
protected function getBackendFiles($backend, $type)
{
$type = strtolower($type ?? '');
switch (strtolower($type ?? '')) {
case 'css':
return $backend->getCSS();
case 'js':
case 'javascript':
case 'script':
return $backend->getJavascript();
}
return [];
} | Get files of the given type from the backend
@param Requirements_Backend $backend
@param string $type js or css
@return array | getBackendFiles | php | silverstripe/silverstripe-framework | tests/php/View/RequirementsTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/RequirementsTest.php | BSD-3-Clause |
private function render($templateString, $data = null)
{
$t = SSViewer::fromString($templateString);
if (!$data) {
$data = new TestFixture();
}
return $t->process($data);
} | Small helper to render templates from strings
Cloned from SSViewerTest | render | php | silverstripe/silverstripe-framework | tests/php/View/ContentNegotiatorTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/ContentNegotiatorTest.php | BSD-3-Clause |
public function shortcodeSaver($arguments, $content, $parser, $tagName, $extra)
{
$this->arguments = $arguments;
$this->contents = $content;
$this->tagName = $tagName;
$this->extra = $extra;
return $content;
} | Stores the result of a shortcode parse in object properties for easy testing access. | shortcodeSaver | php | silverstripe/silverstripe-framework | tests/php/View/Parsers/ShortcodeParserTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/View/Parsers/ShortcodeParserTest.php | BSD-3-Clause |
protected function getRecursive($url, $limit = 10)
{
$this->cssParser = null;
$response = $this->mainSession->get($url);
while (--$limit > 0 && $response instanceof HTTPResponse && $response->getHeader('Location')) {
$response = $this->mainSession->followRedirection();
}
return $response;
} | Follow all redirects recursively
@param string $url
@param int $limit Max number of requests
@return HTTPResponse | getRecursive | php | silverstripe/silverstripe-framework | tests/php/Security/SecurityTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php | BSD-3-Clause |
public function doTestLoginForm($email, $password, $backURL = 'test/link')
{
$this->get(Config::inst()->get(Security::class, 'logout_url'));
$this->session()->set('BackURL', $backURL);
$this->get(Config::inst()->get(Security::class, 'login_url'));
return $this->submitForm(
"MemberLoginForm_LoginForm",
null,
[
'Email' => $email,
'Password' => $password,
'AuthenticationMethod' => MemberAuthenticator::class,
'action_doLogin' => 1,
]
);
} | Execute a log-in form using Director::test().
Helper method for the tests above
@param string $email
@param string $password
@param string $backURL
@return HTTPResponse | doTestLoginForm | php | silverstripe/silverstripe-framework | tests/php/Security/SecurityTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php | BSD-3-Clause |
public function doTestChangepasswordForm($oldPassword, $newPassword)
{
return $this->submitForm(
"ChangePasswordForm_ChangePasswordForm",
null,
[
'OldPassword' => $oldPassword,
'NewPassword1' => $newPassword,
'NewPassword2' => $newPassword,
'action_doChangePassword' => 1,
]
);
} | Helper method to execute a change password form
@param string $oldPassword
@param string $newPassword
@return HTTPResponse | doTestChangepasswordForm | php | silverstripe/silverstripe-framework | tests/php/Security/SecurityTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php | BSD-3-Clause |
protected function assertHasMessage($expected, $errorMessage = null)
{
$messages = [];
$result = $this->getValidationResult();
if ($result) {
foreach ($result->getMessages() as $message) {
$messages[] = $message['message'];
}
}
$this->assertContains($expected, $messages, $errorMessage ?: '');
} | Assert this message is in the current login form errors
@param string $expected
@param string $errorMessage | assertHasMessage | php | silverstripe/silverstripe-framework | tests/php/Security/SecurityTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php | BSD-3-Clause |
protected function getValidationResult()
{
$result = $this->session()->get('FormInfo.MemberLoginForm_LoginForm.result');
if ($result) {
return unserialize($result ?? '');
}
return null;
} | Get validation result from last login form submission
@return ValidationResult | getValidationResult | php | silverstripe/silverstripe-framework | tests/php/Security/SecurityTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/SecurityTest.php | BSD-3-Clause |
public function flushMemberCache($memberIDs = null)
{
if (!$this->cache) {
return;
}
// Hard flush, e.g. flush=1
if (!$memberIDs) {
$this->cache->clear();
}
if ($memberIDs && is_array($memberIDs)) {
foreach (TestCacheFlusher::$categories as $category) {
foreach ($memberIDs as $memberID) {
$key = $this->generateCacheKey($category, $memberID);
$this->cache->delete($key);
}
}
}
} | Clear the cache for this instance only
@param array $memberIDs A list of member IDs | flushMemberCache | php | silverstripe/silverstripe-framework | tests/php/Security/InheritedPermissionsFlusherTest/TestCacheFlusher.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Security/InheritedPermissionsFlusherTest/TestCacheFlusher.php | BSD-3-Clause |
public function providerContextSummary()
{
return [
[
'This is some text. It is a test',
20,
'test',
'… text. It is a <mark>test</mark>'
],
[
// Retains case of original string
'This is some test text. Test test what if you have multiple keywords.',
50,
'some test',
'This is <mark>some</mark> <mark>test</mark> text.'
. ' <mark>Test</mark> <mark>test</mark> what if you have…'
],
[
'Here is some text & HTML included',
20,
'html',
'… text & <mark>HTML</mark> inc…'
],
[
'A dog ate a cat while looking at a Foobar',
100,
'a',
// test that it does not highlight too much (eg every a)
'A dog ate a cat while looking at a Foobar',
],
[
'A dog ate a cat while looking at a Foobar',
100,
'ate',
// it should highlight 3 letters or more.
'A dog <mark>ate</mark> a cat while looking at a Foobar',
],
// HTML Content is plain-textified, and incorrect tags removed
[
'<p>A dog ate a cat while <mark>looking</mark> at a Foobar</p>',
100,
'ate',
// it should highlight 3 letters or more.
'A dog <mark>ate</mark> a cat while looking at a Foobar',
],
[
'<p>This is a lot of text before this but really, this is a test sentence</p>
<p>with about more stuff after the line break</p>',
35,
'test',
'… really, this is a <mark>test</mark> sentence…'
],
[
'<p>This is a lot of text before this but really, this is a test sentence</p>
<p>with about more stuff after the line break</p>',
50,
'with',
'… sentence<br />
<br />
<mark>with</mark> about more stuff…'
]
];
} | each test is in the format input, charactere limit, highlight, expected output
@return array | providerContextSummary | php | silverstripe/silverstripe-framework | tests/php/ORM/DBHTMLTextTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBHTMLTextTest.php | BSD-3-Clause |
protected function getNodeClassFromTree($html, $node)
{
$parser = new CSSContentParser($html);
$xpath = '//ul/li[@data-id="' . $node->ID . '"]';
$object = $parser->getByXpath($xpath);
foreach ($object[0]->attributes() as $key => $attr) {
if ($key == 'class') {
return (string)$attr;
}
}
return '';
} | Get the HTML class attribute from a node in the sitetree
@param string$html
@param DataObject $node
@return string | getNodeClassFromTree | php | silverstripe/silverstripe-framework | tests/php/ORM/MarkedSetTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/MarkedSetTest.php | BSD-3-Clause |
public function providerContextSummary()
{
return [
[
'This is some text. It is a test',
20,
'test',
'… text. It is a <mark>test</mark>'
],
[
// Retains case of original string
'This is some test text. Test test what if you have multiple keywords.',
50,
'some test',
'This is <mark>some</mark> <mark>test</mark> text.'
. ' <mark>Test</mark> <mark>test</mark> what if you have…'
],
[
'Here is some text & HTML included',
20,
'html',
'… text & <mark>HTML</mark> inc…'
],
[
'A dog ate a cat while looking at a Foobar',
100,
'a',
// test that it does not highlight too much (eg every a)
'A dog ate a cat while looking at a Foobar',
],
[
'A dog ate a cat while looking at a Foobar',
100,
'ate',
// it should highlight 3 letters or more.
'A dog <mark>ate</mark> a cat while looking at a Foobar',
],
[
'both schön and können have umlauts',
21,
'schön',
// check UTF8 support
'both <mark>schön</mark> and können…',
],
[
'both schön and können have umlauts',
21,
'',
// check non-existent search term
'both schön and können…',
]
];
} | each test is in the format input, character limit, highlight, expected output
@return array | providerContextSummary | php | silverstripe/silverstripe-framework | tests/php/ORM/DBTextTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBTextTest.php | BSD-3-Clause |
public function providerSummary()
{
return [
'simple test' => [
'This is some text. It is a test',
3,
false,
'This is some…',
],
'custom ellipses' => [
// check custom ellipsis
'This is a test text in a longer sentence and a custom ellipsis.',
8,
'...', // regular dots instead of the ellipsis character
'This is a test text in a longer...',
],
'umlauts' => [
'both schön and können have umlauts',
5,
false,
'both schön and können have…',
],
'invalid UTF' => [
// check invalid UTF8 handling — input is an invalid UTF sequence, output should be empty string
"\xf0\x28\x8c\xbc",
50,
false,
'',
],
'treats period as sentence boundary' => [
'This is some text. It is a test. There are three sentences.',
10,
false,
'This is some text. It is a test.',
],
'treats exclamation mark as sentence boundary' => [
'This is some text! It is a test! There are three sentences.',
10,
false,
'This is some text! It is a test!',
],
'treats question mark as sentence boundary' => [
'This is some text? It is a test? There are three sentences.',
10,
false,
'This is some text? It is a test?',
],
'does not treat colon as sentence boundary' => [
'This is some text: It is a test: There are three sentences.',
10,
false,
'This is some text: It is a test: There are…',
],
];
} | each test is in the format input, word limit, add ellipsis (false or string), expected output
@return array | providerSummary | php | silverstripe/silverstripe-framework | tests/php/ORM/DBTextTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBTextTest.php | BSD-3-Clause |
protected function clean($input)
{
$nbsp = html_entity_decode(' ', 0, 'UTF-8');
return str_replace(' ', $nbsp ?? '', trim($input ?? ''));
} | In some cases and locales, validation expects non-breaking spaces.
Duplicates non-public NumericField::clean method
@param string $input
@return string The input value, with all spaces replaced with non-breaking spaces | clean | php | silverstripe/silverstripe-framework | tests/php/ORM/DBMoneyTest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DBMoneyTest.php | BSD-3-Clause |
public function resetCounts()
{
$update = new SQLUpdate(
sprintf('"%s"', TreeNode::baseTable()),
['"WriteCount"' => 0]
);
$results = $update->execute();
} | Reset the WriteCount on all TreeNodes | resetCounts | php | silverstripe/silverstripe-framework | tests/php/ORM/DataObjectTest/TreeNode.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/TreeNode.php | BSD-3-Clause |
public function prepValueForDB($value)
{
if ($value) {
return $this->dynamicAssignment
? ['ABS(?)' => [1]]
: 1;
}
return 0;
} | If the field value and $dynamicAssignment are true, we'll try to do a dynamic assignment.
@param $value
@return array|int | prepValueForDB | php | silverstripe/silverstripe-framework | tests/php/ORM/DataObjectTest/MockDynamicAssignmentDBField.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/MockDynamicAssignmentDBField.php | BSD-3-Clause |
public function getSubclassFieldWithOverride()
{
return $this->getField('SubclassFieldWithOverride') . ' (override)';
} | Override the value of SubclassFieldWithOverride
@return string Suffixes " (override)" to SubclassFieldWithOverride value | getSubclassFieldWithOverride | php | silverstripe/silverstripe-framework | tests/php/ORM/DataObjectTest/SubTeam.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/ORM/DataObjectTest/SubTeam.php | BSD-3-Clause |
protected function pushManifest(ClassManifest $manifest)
{
$this->manifests++;
ClassLoader::inst()->pushManifest($manifest);
} | Safely push a new class manifest.
These will be cleaned up on tearDown()
@param ClassManifest $manifest | pushManifest | php | silverstripe/silverstripe-framework | tests/php/i18n/i18nTestManifest.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/i18n/i18nTestManifest.php | BSD-3-Clause |
public function setUSBirthday($val, $record = null)
{
$this->Birthday = preg_replace('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-90-9]{2,4})/', '\\3-\\1-\\2', $val ?? '');
} | Custom setter for "Birthday" property when passed/imported
in different format.
@param string $val
@param array $record | setUSBirthday | php | silverstripe/silverstripe-framework | tests/php/Dev/CsvBulkLoaderTest/Player.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Dev/CsvBulkLoaderTest/Player.php | BSD-3-Clause |
public function mockException($depth = 0)
{
switch ($depth) {
case 0:
try {
$this->mockException(1);
} catch (\Exception $ex) {
return $ex;
}
return null;
break;
case 4:
throw new Exception('Error');
default:
return $this->mockException($depth + 1);
}
} | Generate an exception with a trace depeth of at least 4
@param int $depth
@return Exception
@throws Exception | mockException | php | silverstripe/silverstripe-framework | tests/php/Logging/DetailedErrorFormatterTest/ErrorGenerator.php | https://github.com/silverstripe/silverstripe-framework/blob/master/tests/php/Logging/DetailedErrorFormatterTest/ErrorGenerator.php | BSD-3-Clause |
public function __construct(array $resultSet = [])
{
$this->resultSet = $resultSet;
} | Creates a new mock statement that will serve the provided fake result set to clients.
@param array $resultSet The faked SQL result set. | __construct | php | Sylius/Sylius | tests/Functional/Doctrine/Mock/DriverResultMock.php | https://github.com/Sylius/Sylius/blob/master/tests/Functional/Doctrine/Mock/DriverResultMock.php | MIT |
protected function getStub()
{
return __DIR__.'/Stubs/RegexCollectionClass.stub';
} | Get the stub file for the generator.
@return string | getStub | php | YorCreative/Laravel-Scrubber | src/Commands/MakeRegexClass.php | https://github.com/YorCreative/Laravel-Scrubber/blob/master/src/Commands/MakeRegexClass.php | MIT |
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Scrubber\RegexCollection';
} | Get the default namespace for the class.
@param string $rootNamespace
@return string | getDefaultNamespace | php | YorCreative/Laravel-Scrubber | src/Commands/MakeRegexClass.php | https://github.com/YorCreative/Laravel-Scrubber/blob/master/src/Commands/MakeRegexClass.php | MIT |
protected function pageLevel()
{
$siteTitle = $this->setting->getValueByKey('site_title');
if (!empty($siteTitle)) {
$siteTitle = ' | ' . $siteTitle;
}
$this->tags[] = '<title>' . $this->page->getTitle() . $siteTitle . '</title>';
$this->tags[] = '<link rel="canonical" href="' . $this->page->getCanonical() . '" />';
$description = $this->page->getDescription();
if (!empty($description)) {
$this->tags[] = '<meta name="description" content="' . $description . '" />';
}
return $this;
} | Create all meta tags that are saved in pages table row. | pageLevel | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
protected function webmaster()
{
$webmaster_tools = $this->meta['webmaster_tools'] ?? [];
$this->generator($webmaster_tools);
return $this;
} | Generate webmaster validation meta tags
@return $this | webmaster | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
public function asHtml()
{
$metaHtml = implode("\n", $this->tags);
$metaHtml .= PHP_EOL . $this->schemaJsonLd() . PHP_EOL;
return $metaHtml;
} | Show tags array into html string
@return string | asHtml | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
public function make()
{
$this->makeMeta();
$this->robots()->webmaster()->pageLevel()->og()->twitter()->otherTags();
return $this;
} | Generate meta tags adn save them into tags array
@return $this | make | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
public function show()
{
if ($this->hasPage()) {
return $this->make()->asHtml();
}
} | For outside. It will make meta tags and then return as html string. | show | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
public function hasPage()
{
return $this->page instanceof Page;
} | Check has this path has a seo page. If so return true or false
@return bool | hasPage | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
protected function makeMeta()
{
if (!$this->hasPage()) {
return [];
}
$pageMeta = $this->page->metaTags();
$globalMeta = MetaTag::withContent('', 'global');
foreach ($pageMeta as $group => $tags) {
foreach ($tags as $tag) {
$this->meta[$group][$tag->id] = $tag;
}
}
foreach ($globalMeta as $meta) {
if (!empty($meta->group)) {
$this->meta[$meta->group][$meta->id] = $meta;
} elseif ($meta->visibility == 'global') {
$this->meta['global'][$meta->id] = $meta;
} elseif ($meta->visibility == 'page') {
$this->meta['page'][$meta->id] = $meta;
} else {
$this->meta['others'][$meta->id] = $meta;
}
}
return $this->meta;
} | Normalize meta tags with content
@return array | makeMeta | php | digitaldreams/laravel-seo-tools | src/Tag.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Tag.php | MIT |
public function authorize()
{
return auth()->user()->can('update', $this->route('setting'));
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Update.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Update.php | MIT |
public function rules()
{
return [
'key ' => 'required|unique:seo_settings,key|max:255',
'value ' => 'nullable|max:255',
'status ' => 'required|max:255',
'group ' => 'nullable|max:255',
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Update.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Update.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Update.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Update.php | MIT |
public function authorize()
{
return auth()->user()->can('create', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Store.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Store.php | MIT |
public function rules()
{
return [
'settings ' => 'array',
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Store.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Store.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Store.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Store.php | MIT |
public function authorize()
{
return auth()->user()->can('update', $this->route('setting'));
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Edit.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Edit.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Edit.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Edit.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Edit.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Edit.php | MIT |
public function authorize()
{
return auth()->user()->can('index', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Index.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Index.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Settings/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Settings/Index.php | MIT |
public function authorize()
{
return auth()->user()->can('index', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Tool.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Tool.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Tool.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Tool.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Tool.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Tool.php | MIT |
public function authorize()
{
return auth()->user()->can('index', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Sitemap.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Sitemap.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Sitemap.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Sitemap.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Sitemap.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Sitemap.php | MIT |
public function authorize()
{
return auth()->user()->can('index', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Social.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Social.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Social.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Social.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Social.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Social.php | MIT |
public function authorize()
{
return auth()->user()->can('index',Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Advanced.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Advanced.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Advanced.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Advanced.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Advanced.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Advanced.php | MIT |
public function authorize()
{
return auth()->user()->can('index', Setting::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Index.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Index.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Dashboard/Index.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Dashboard/Index.php | MIT |
public function authorize()
{
return auth()->user()->can('create',PageImage::class);
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Create.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Create.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Create.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Create.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Create.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Create.php | MIT |
public function authorize()
{
return auth()->user()->can('delete',$this->route('pageImage'));
} | Determine if the user is authorized to make this request.
@return bool | authorize | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Destroy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Destroy.php | MIT |
public function rules()
{
return [
];
} | Get the validation rules that apply to the request.
@return array | rules | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Destroy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Destroy.php | MIT |
public function messages()
{
return [
];
} | Get the error messages for the defined validation rules.
@return array | messages | php | digitaldreams/laravel-seo-tools | src/Http/Requests/Images/Destroy.php | https://github.com/digitaldreams/laravel-seo-tools/blob/master/src/Http/Requests/Images/Destroy.php | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.