_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q257800 | NoteController.destroy | test | public function destroy($id, $noteId)
{
if ($this->inventory->deleteNote($id, $noteId)) {
$message = 'Successfully updated note.';
return redirect()->route('maintenance.inventory.show', [$id])->withSuccess($message);
} else {
$message = 'There was an issue deleti... | php | {
"resource": ""
} |
q257801 | InventoryStock.getLastMovementAttribute | test | public function getLastMovementAttribute()
{
if ($this->movements->count() > 0) {
$movement = $this->movements->first();
if ($movement instanceof InventoryStockMovement
&& $movement->after > $movement->before) {
return sprintf('<b>%s</b> (Stock was ad... | php | {
"resource": ""
} |
q257802 | InventoryStock.getLastMovementByAttribute | test | public function getLastMovementByAttribute()
{
if ($this->movements->count() > 0) {
$movement = $this->movements->first();
if ($movement instanceof InventoryStockMovement
&& $movement->user instanceof User) {
return $movement->user->getRecipientName()... | php | {
"resource": ""
} |
q257803 | InventoryStock.getQuantityMetricAttribute | test | public function getQuantityMetricAttribute()
{
$quantity = $this->getAttribute('quantity');
if ($this->item && $this->item->metric) {
$metric = $this->item->metric->name;
} else {
$metric = null;
}
return trim(sprintf('%s %s', $quantity, $metric));
... | php | {
"resource": ""
} |
q257804 | InventoryStockViewer.btnPutBackSomeForWorkOrder | test | public function btnPutBackSomeForWorkOrder(WorkOrder $workOrder)
{
if ($this->entity->item) {
return view('viewers.inventory.stock.buttons.put-back-some-work-order', [
'workOrder' => $workOrder,
'stock' => $this->entity,
]);
}
retu... | php | {
"resource": ""
} |
q257805 | InventoryStockViewer.btnPutBackAllForWorkOrder | test | public function btnPutBackAllForWorkOrder(WorkOrder $workOrder)
{
if ($this->entity->item) {
return view('viewers.inventory.stock.buttons.put-back-all-work-order', [
'workOrder' => $workOrder,
'stock' => $this->entity,
]);
}
return... | php | {
"resource": ""
} |
q257806 | WorkOrderSessionController.end | test | public function end($workOrderId)
{
if ($this->processor->end($workOrderId)) {
flash()->success('Success!', 'Successfully ended your session. Your hours have been logged.');
return redirect()->route('maintenance.work-orders.show', [$workOrderId]);
} else {
flash(... | php | {
"resource": ""
} |
q257807 | WorkRequestPresenter.table | test | public function table($workRequest)
{
return $this->table->of('work-requests', function (TableGrid $table) use ($workRequest) {
$table->with($workRequest)->paginate($this->perPage);
$table->attributes([
'class' => 'table table-hover table-striped',
]);
... | php | {
"resource": ""
} |
q257808 | WorkRequestPresenter.form | test | public function form(WorkRequest $request)
{
return $this->form->of('work-requests', function (FormGrid $form) use ($request) {
if ($request->exists) {
$method = 'PATCH';
$url = route('maintenance.work-requests.update', [$request->getKey()]);
$form... | php | {
"resource": ""
} |
q257809 | AssignmentController.store | test | public function store($workOrder_id)
{
if ($this->assignmentValidator->passes()) {
$workOrder = $this->workOrder->find($workOrder_id);
$data = $this->inputAll();
$data['work_order_id'] = $workOrder->id;
$records = $this->assignment->setInput($data)->create()... | php | {
"resource": ""
} |
q257810 | AssignmentController.destroy | test | public function destroy($workOrder_id, $assignment_id)
{
if ($this->assignment->destroy($assignment_id)) {
$this->message = 'Successfully removed worker from this work order.';
$this->messageType = 'success';
$this->redirect = route('maintenance.work-orders.show', [$workO... | php | {
"resource": ""
} |
q257811 | Selection.datalist | test | public function datalist(string $id, array $list = []): Htmlable
{
$this->type = 'datalist';
$attributes['id'] = $id;
$html = [];
if (Arr::isAssoc($list)) {
foreach ($list as $value => $display) {
$html[] = $this->option($display, $value, null, []);
... | php | {
"resource": ""
} |
q257812 | Selection.placeholderOption | test | protected function placeholderOption(string $display, $selected): Htmlable
{
$options = [
'selected' => $this->getSelectedValue(null, $selected),
'disabled' => true,
'value' => '',
];
return $this->toHtmlString(\sprintf(
'<option%s>%s</opti... | php | {
"resource": ""
} |
q257813 | Creator.getAppendage | test | protected function getAppendage(string $method): string
{
list($method, $appendage) = [\strtoupper($method), ''];
// If the HTTP method is in this list of spoofed methods, we will attach the
// method spoofer hidden input to the form. This allows us to use regular
// form to initiat... | php | {
"resource": ""
} |
q257814 | Componentable.renderComponent | test | protected function renderComponent(string $name, array $arguments): Htmlable
{
$component = static::$components[$name];
$data = $this->getComponentData($component['signature'], $arguments);
return new HtmlString(
$this->view->make($component['view'], $data)->render()
... | php | {
"resource": ""
} |
q257815 | Componentable.getComponentData | test | protected function getComponentData(array $signature, array $arguments): array
{
$data = [];
$i = 0;
foreach ($signature as $variable => $default) {
// If the "variable" value is actually a numeric key, we can assume that
// no default had been specified for the comp... | php | {
"resource": ""
} |
q257816 | BladeServiceProvider.register | test | protected function register()
{
$this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
$namespaces = [
'Html' => \get_class_methods(HtmlBuilder::class),
'Form' => \get_class_methods(FormBuilder::class),
];
f... | php | {
"resource": ""
} |
q257817 | FormBuilder.model | test | public function model($model, array $options = []): Htmlable
{
$this->model = $model;
return $this->open($options);
} | php | {
"resource": ""
} |
q257818 | FormBuilder.formatLabel | test | protected function formatLabel(string $name, ?string $value): string
{
return $value ?? \ucwords(\str_replace('_', ' ', $name));
} | php | {
"resource": ""
} |
q257819 | FormBuilder.reset | test | public function reset(?string $value = null, array $attributes = []): Htmlable
{
return $this->input('reset', null, $value, $attributes);
} | php | {
"resource": ""
} |
q257820 | FormBuilder.submit | test | public function submit(?string $value = null, array $options = []): Htmlable
{
return $this->input('submit', null, $value, $options);
} | php | {
"resource": ""
} |
q257821 | FormBuilder.request | test | protected function request(string $name)
{
if (! $this->considerRequest || ! isset($this->request)) {
return null;
}
return $this->request->input($this->transformKey($name));
} | php | {
"resource": ""
} |
q257822 | HtmlBuilder.linkAsset | test | public function linkAsset(string $url, ?string $title = null, array $attributes = [], ?bool $secure = null): Htmlable
{
$url = $this->url->asset($url, $secure);
return $this->link($url, $title ?: $url, $attributes, $secure);
} | php | {
"resource": ""
} |
q257823 | HtmlBuilder.linkRoute | test | public function linkRoute(string $name, ?string $title = null, array $parameters = [], array $attributes = []): Htmlable
{
return $this->link($this->url->route($name, $parameters), $title, $attributes);
} | php | {
"resource": ""
} |
q257824 | HtmlBuilder.listingElement | test | protected function listingElement($key, string $type, $value): string
{
if (\is_array($value)) {
return $this->nestedListing($key, $type, $value);
} else {
return '<li>'.$this->entities($value).'</li>';
}
} | php | {
"resource": ""
} |
q257825 | HtmlBuilder.attributes | test | public function attributes(array $attributes): string
{
$html = [];
// For numeric keys we will assume that the key and the value are the same
// as this will convert HTML attributes such as "required" to a correct
// form like required="required" instead of using incorrect numerics... | php | {
"resource": ""
} |
q257826 | HtmlServiceProvider.registerHtmlBuilder | test | protected function registerHtmlBuilder(): void
{
$this->app->singleton('html', function ($app) {
return new HtmlBuilder(
$app->make('url'), $app->make('view')
);
});
} | php | {
"resource": ""
} |
q257827 | HtmlServiceProvider.registerFormBuilder | test | protected function registerFormBuilder(): void
{
$this->app->singleton('form', function ($app) {
return (new FormBuilder(
$app->make('html'), $app->make('url'), $app->make('view'), $app->make('request')
))->setSessionStore($app->make('session.store'));
});
... | php | {
"resource": ""
} |
q257828 | Input.search | test | public function search(string $name, ?string $value = null, array $options = []): Htmlable
{
return $this->input('search', $name, $value, $options);
} | php | {
"resource": ""
} |
q257829 | Input.datetime | test | public function datetime(string $name, $value = null, array $options = []): Htmlable
{
if ($value instanceof DateTime) {
$value = $value->format(DateTime::RFC3339);
}
return $this->input('datetime', $name, $value, $options);
} | php | {
"resource": ""
} |
q257830 | Input.file | test | public function file(string $name, array $options = []): Htmlable
{
return $this->input('file', $name, null, $options);
} | php | {
"resource": ""
} |
q257831 | BaseXmlResponse.removeXmlFirstLine | test | protected function removeXmlFirstLine($str)
{
$first = '<?xml version="1.0"?>';
if (Str::startsWith($str, $first)) {
return trim(substr($str, strlen($first)));
}
return $str;
} | php | {
"resource": ""
} |
q257832 | Dictionary.load | test | public function load($locale)
{
$locale = $this->unifyLocale($locale);
$file = self::$fileLocation . DIRECTORY_SEPARATOR . $locale . '.ini';
$this->dictionary = array();
if (! file_exists(realpath($file))) {
return $this;
}
foreach (p... | php | {
"resource": ""
} |
q257833 | Dictionary.parseFile | test | public static function parseFile($locale)
{
$path = self::$fileLocation . DIRECTORY_SEPARATOR;
$file = $path . 'hyph_' . $locale . '.dic';
if (! file_Exists($file)) {
throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException('The given Path does not exist');
}
... | php | {
"resource": ""
} |
q257834 | Dictionary.getPatternsForWord | test | public function getPatternsForWord($word)
{
$return = array();
$word = '.' . $word . '.';
$strlen = mb_strlen($word);
for ($i = 0; $i <= $strlen; $i ++) {
for ($j = 2; $j <= ($strlen-$i); $j++) {
$substr = mb_substr($word, $i, $j);
if (! is... | php | {
"resource": ""
} |
q257835 | Dictionary.unifyLocale | test | private function unifyLocale($locale)
{
if (2 == strlen($locale)) {
return strtolower($locale);
}
if (preg_match('/([a-zA-Z]{2})[^a-zA-Z]+([a-zA-Z]{2})/i', $locale, $result)) {
return strtolower($result[1]) . '_' . strtoupper($result[2]);
}
return (st... | php | {
"resource": ""
} |
q257836 | TokenizerRegistry.tokenize | test | public function tokenize($string)
{
if (! $string instanceof TokenRegistry) {
$wt = new WordToken($string);
$string = new TokenRegistry();
$string->add($wt);
}
foreach ($this as $tokenizer) {
$string = $tokenizer->run($string);
}
... | php | {
"resource": ""
} |
q257837 | CustomHyphenationTokenizer.run | test | public function run($input)
{
if ($input instanceof TokenRegistry) {
// Tokenize a TokenRegistry
$f = clone($input);
foreach ($input as $token) {
if (! $token instanceof WordToken) {
continue;
}
$newToken... | php | {
"resource": ""
} |
q257838 | Filter.setOptions | test | public function setOptions(\Org\Heigl\Hyphenator\Options $options)
{
$this->options =$options;
return $this;
} | php | {
"resource": ""
} |
q257839 | DictionaryRegistry.add | test | public function add(Dictionary $dict)
{
if (! in_array($dict, $this->registry)) {
$this->registry[] = $dict;
}
return $this;
} | php | {
"resource": ""
} |
q257840 | DictionaryRegistry.getHyphenationPattterns | test | public function getHyphenationPattterns($word)
{
$pattern = array();
foreach ($this as $dictionary) {
$pattern = array_merge($pattern, $dictionary->getPatternsForWord($word));
}
return $pattern;
} | php | {
"resource": ""
} |
q257841 | Options.setFilters | test | public function setFilters($filters)
{
$this->filters = array();
if (! is_array($filters)) {
$filters = explode(',', $filters);
}
foreach ($filters as $filter) {
$this->addFilter($filter);
}
return $this;
} | php | {
"resource": ""
} |
q257842 | Options.addFilter | test | public function addFilter($filter)
{
if (is_string($filter)) {
$filter = trim($filter);
} elseif (! $filter instanceof Filter) {
throw new \UnexpectedValueException('Expceted instanceof Org\Heigl\Hyphenator\Filter\Filter or string');
}
if (! $filter) {
... | php | {
"resource": ""
} |
q257843 | Options.setTokenizers | test | public function setTokenizers($tokenizers)
{
$this->tokenizers = array();
if (! is_array($tokenizers)) {
$tokenizers = explode(',', $tokenizers);
}
foreach ($tokenizers as $tokenizer) {
$this->addTokenizer($tokenizer);
}
return $this;
} | php | {
"resource": ""
} |
q257844 | Options.addTokenizer | test | public function addTokenizer($tokenizer)
{
if (is_string($tokenizer)) {
$tokenizer = trim($tokenizer);
} elseif (! $tokenizer instanceof Tokenizer) {
throw new \UnexpectedValueException(
'Expceted instanceof Org\Heigl\Hyphenator\Tokenizer\Tokenizer or string'
... | php | {
"resource": ""
} |
q257845 | Options.factory | test | public static function factory($file)
{
if (! file_Exists($file)) {
$file = $file . '.dist';
if (! file_exists($file)) {
throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException($file);
}
}
$params = parse_ini_file($file);
if... | php | {
"resource": ""
} |
q257846 | Pattern.getText | test | public function getText()
{
if (! $this->text) {
throw new \Org\Heigl\Hyphenator\Exception\NoPatternSetException('No Pattern set');
}
return $this->text;
} | php | {
"resource": ""
} |
q257847 | Pattern.getPattern | test | public function getPattern()
{
if (! $this->pattern) {
throw new \Org\Heigl\Hyphenator\Exception\NoPatternSetException('No Pattern set');
}
return $this->pattern;
} | php | {
"resource": ""
} |
q257848 | Hyphenator.setOptions | test | public function setOptions(Options $options)
{
$this->options = $options;
$this->tokenizers->cleanup();
foreach ($this->options->getTokenizers() as $tokenizer) {
$this->addTokenizer($tokenizer);
}
return $this;
} | php | {
"resource": ""
} |
q257849 | Hyphenator.getOptions | test | public function getOptions()
{
if (null === $this->options) {
$optFile = $this->getHomePath() . DIRECTORY_SEPARATOR . 'Hyphenator.properties';
$this->setOptions(Options::factory($optFile));
}
return $this->options;
} | php | {
"resource": ""
} |
q257850 | Hyphenator.addDictionary | test | public function addDictionary($dictionary)
{
if (! $dictionary instanceof \Org\Heigl\Hyphenator\Dictionary\Dictionary) {
\Org\Heigl\Hyphenator\Dictionary\Dictionary::setFileLocation($this->getHomePath() . '/files/dictionaries');
$dictionary = \Org\Heigl\Hyphenator\Dictionary\Dictiona... | php | {
"resource": ""
} |
q257851 | Hyphenator.addFilter | test | public function addFilter($filter)
{
if (! $filter instanceof \Org\Heigl\Hyphenator\Filter\Filter) {
$filter = '\\Org\\Heigl\\Hyphenator\\Filter\\' . ucfirst($filter) . 'Filter';
$filter = new $filter();
}
$filter->setOptions($this->getOptions());
$this->filte... | php | {
"resource": ""
} |
q257852 | Hyphenator.addTokenizer | test | public function addTokenizer($tokenizer)
{
if (! $tokenizer instanceof \Org\Heigl\Hyphenator\Tokenizer\Tokenizer) {
$tokenizer = '\\Org\\Heigl\Hyphenator\\Tokenizer\\' . ucfirst($tokenizer) . 'Tokenizer';
$tokenizer = new $tokenizer();
}
$this->tokenizers->add($tokeni... | php | {
"resource": ""
} |
q257853 | Hyphenator.getTokenizers | test | public function getTokenizers()
{
if (0 == $this->tokenizers->count()) {
foreach ($this->getOptions()->getTokenizers() as $tokenizer) {
$this->addTokenizer($tokenizer);
}
}
return $this->tokenizers;
} | php | {
"resource": ""
} |
q257854 | Hyphenator.getDictionaries | test | public function getDictionaries()
{
if (0 == $this->dicts->count()) {
$this->addDictionary($this->getOptions()->getDefaultLocale());
}
return $this->dicts;
} | php | {
"resource": ""
} |
q257855 | Hyphenator.getFilters | test | public function getFilters()
{
if (0 == $this->filters->count()) {
foreach ($this->getOptions()->getFilters() as $filter) {
$this->addFilter($filter);
}
}
return $this->filters;
} | php | {
"resource": ""
} |
q257856 | Hyphenator.hyphenate | test | public function hyphenate($string)
{
$tokens = $this->tokenizers->tokenize($string);
$tokens = $this->getHyphenationPattern($tokens);
$tokens = $this->filter($tokens);
if (1 === count($tokens) && 1 === $this->getFilters()->count()) {
$tokens->rewind();
return ... | php | {
"resource": ""
} |
q257857 | Hyphenator.getHyphenationPattern | test | public function getHyphenationPattern(Tokenizer\TokenRegistry $registry)
{
$minWordLength = $this->getOptions()->getMinWordLength();
foreach ($registry as $token) {
if (! $token instanceof \Org\Heigl\Hyphenator\Tokenizer\WordToken) {
continue;
}
if... | php | {
"resource": ""
} |
q257858 | Hyphenator.getPatternForToken | test | public function getPatternForToken(Tokenizer\WordToken $token)
{
foreach ($this->getDictionaries() as $dictionary) {
$token->addPattern($dictionary->getPatternsForWord($token->get()));
}
return $token;
} | php | {
"resource": ""
} |
q257859 | Hyphenator.setDefaultHomePath | test | public static function setDefaultHomePath($homePath)
{
if (! file_exists($homePath)) {
throw new Exception\PathNotFoundException($homePath . ' does not exist');
}
if (! is_Dir($homePath)) {
throw new Exception\PathNotDirException($homePath . ' is not a directory');
... | php | {
"resource": ""
} |
q257860 | Hyphenator.getDefaultHomePath | test | public static function getDefaultHomePath()
{
if (is_Dir(self::$defaultHomePath)) {
return self::$defaultHomePath;
}
if (defined('HYPHENATOR_HOME') && is_Dir(HYPHENATOR_HOME)) {
return realpath(HYPHENATOR_HOME);
}
if ($home = getenv('HYPHENATOR_HOME'))... | php | {
"resource": ""
} |
q257861 | Hyphenator.setHomePath | test | public function setHomePath($homePath)
{
if (! file_exists($homePath)) {
throw new Exception\PathNotFoundException($homePath . ' does not exist');
}
if (! is_Dir($homePath)) {
throw new Exception\PathNotDirException($homePath . ' is not a directory');
}
... | php | {
"resource": ""
} |
q257862 | Hyphenator.factory | test | public static function factory($path = null, $locale = null)
{
$hyphenator = new Hyphenator();
if (null !== $path && file_Exists($path)) {
$hyphenator->setHomePath($path);
}
if (null !== $locale) {
$hyphenator->getOptions()->setDefaultLocale($locale);
... | php | {
"resource": ""
} |
q257863 | Hyphenator.__autoload | test | public static function __autoload($className)
{
if (0 !== strpos($className, 'Org\\Heigl\\Hyphenator')) {
return false;
}
$className = substr($className, strlen('Org\\Heigl\\Hyphenator\\'));
$file = str_replace('\\', '/', $className) . '.php';
$fileName = __DIR__ ... | php | {
"resource": ""
} |
q257864 | TokenRegistry.replace | test | public function replace(Token $oldToken, array $newTokens)
{
// Get the current key of the element.
$key = array_search($oldToken, $this->registry, true);
if (false === $key) {
return $this;
}
$replacement = array();
// Check for any non-token-elements an... | php | {
"resource": ""
} |
q257865 | TokenRegistry.getTokenWithKey | test | public function getTokenWithKey($key)
{
if (array_key_exists($key, $this->registry)) {
return $this->registry[$key];
}
return null;
} | php | {
"resource": ""
} |
q257866 | WordToken.getMergedPattern | test | public function getMergedPattern($quality = \Org\Heigl\Hyphenator\Hyphenator::QUALITY_HIGHEST)
{
$content = $this->getHyphenateContent();
$endPattern = str_repeat('0', mb_strlen($content)+1);
foreach ($this->pattern as $string => $pattern) {
$strStart = -1;
while (fal... | php | {
"resource": ""
} |
q257867 | FilterRegistry.getFilterWithKey | test | public function getFilterWithKey($key)
{
if (array_key_exists($key, $this->registry)) {
return $this->registry[$key];
}
return null;
} | php | {
"resource": ""
} |
q257868 | FilterRegistry.filter | test | public function filter(\Org\Heigl\Hyphenator\Tokenizer\TokenRegistry $tokens)
{
foreach ($this as $filter) {
$tokens = $filter->run($tokens);
}
return $tokens;
} | php | {
"resource": ""
} |
q257869 | ThreeLeggedAuth.fetchToken | test | public function fetchToken($authorizationCode)
{
$additionalParams = [
'code' => $authorizationCode,
'redirect_uri' => $this->configuration->getRedirectUrl(),
];
$response = parent::fetchAccessToken('authentication/v1/gettoken', 'authorization_code', $additionalParam... | php | {
"resource": ""
} |
q257870 | ShopMigrationTask.migrateOrders | test | public function migrateOrders()
{
$start = $count = 0;
$batch = Order::get()->sort('Created', 'ASC')->limit($start, self::$batch_size);
while ($batch->exists()) {
foreach ($batch as $order) {
$this->migrate($order);
echo '. ';
$coun... | php | {
"resource": ""
} |
q257871 | ShopMigrationTask.migrate | test | public function migrate(Order $order)
{
//TODO: set a from / to version to preform a migration with
$this->migrateStatuses($order);
$this->migrateMemberFields($order);
$this->migrateShippingValues($order);
$this->migrateOrderCalculation($order);
$order->write();
} | php | {
"resource": ""
} |
q257872 | ShopMigrationTask.migrateShippingValues | test | public function migrateShippingValues($order)
{
//TODO: see if this actually works..it probably needs to be writeen to a SQL query
if ($order->hasShippingCost && abs($order->Shipping)) {
$modifier1 = Base::create();
$modifier1->Amount = $order->Shipping < 0 ? abs($order->Ship... | php | {
"resource": ""
} |
q257873 | ShopMigrationTask.migrateOrderCalculation | test | public function migrateOrderCalculation($order)
{
if (!is_numeric($order->Total) || $order->Total <= 0) {
$order->calculate();
$order->write();
}
} | php | {
"resource": ""
} |
q257874 | CalculateProductPopularity.viaphp | test | public function viaphp()
{
$ps = singleton(Product::class);
$q = $ps->buildSQL('"SilverShop_Product"."AllowPurchase" = 1');
$select = $q->select;
$select['NewPopularity'] =
self::config()->number_sold_calculation_type . '("SilverShop_OrderItem"."Quantity") AS "NewPopulari... | php | {
"resource": ""
} |
q257875 | CheckoutPage.requireDefaultRecords | test | public function requireDefaultRecords()
{
parent::requireDefaultRecords();
if (!self::get()->exists() && $this->config()->create_default_pages) {
$page = self::create()->update(
[
'Title' => 'Checkout',
'URLSegment' => Checko... | php | {
"resource": ""
} |
q257876 | OrderProcessor.makePayment | test | public function makePayment($gateway, $gatewaydata = array(), $successUrl = null, $cancelUrl = null)
{
//create payment
$payment = $this->createPayment($gateway);
if (!$payment) {
//errors have been stored.
return null;
}
$payment->setSuccessUrl($succ... | php | {
"resource": ""
} |
q257877 | OrderProcessor.getGatewayData | test | protected function getGatewayData($customData)
{
$shipping = $this->order->getShippingAddress();
$billing = $this->order->getBillingAddress();
$numPayments = Payment::get()
->filter(array('OrderID' => $this->order->ID))
->count() - 1;
$transactionId = $this-... | php | {
"resource": ""
} |
q257878 | OrderProcessor.createPayment | test | public function createPayment($gateway)
{
if (!GatewayInfo::isSupported($gateway)) {
$this->error(
_t(
__CLASS__ . ".InvalidGateway",
"`{gateway}` isn't a valid payment gateway.",
'gateway is the name of the payment gate... | php | {
"resource": ""
} |
q257879 | OrderProcessor.completePayment | test | public function completePayment()
{
if (!$this->order->IsPaid()) {
// recalculate order to be sure we have the correct total
$this->order->calculate();
$this->order->extend('onPayment'); //a payment has been made
//place the order, if not already placed
... | php | {
"resource": ""
} |
q257880 | OrderProcessor.canPlace | test | public function canPlace(Order $order)
{
if (!$order) {
$this->error(_t(__CLASS__ . ".NoOrder", "Order does not exist."));
return false;
}
//order status is applicable
if (!$order->IsCart()) {
$this->error(_t(__CLASS__ . ".NotCart", "Order is not a... | php | {
"resource": ""
} |
q257881 | ShopCountry.Nice | test | public function Nice()
{
$val = ShopConfigExtension::countryCode2name($this->value);
if (!$val) {
$val = $this->value;
}
return _t(__CLASS__ . '.' . $this->value, $val);
} | php | {
"resource": ""
} |
q257882 | Checkout.setPaymentMethod | test | public function setPaymentMethod($paymentmethod)
{
$methods = GatewayInfo::getSupportedGateways();
if (!isset($methods[$paymentmethod])) {
ShopTools::getSession()
->set('Checkout.PaymentMethod', null)
->clear('Checkout.PaymentMethod');
return $... | php | {
"resource": ""
} |
q257883 | Checkout.getSelectedPaymentMethod | test | public function getSelectedPaymentMethod($nice = false)
{
$methods = GatewayInfo::getSupportedGateways();
reset($methods);
$method = count($methods) === 1 ? key($methods) : ShopTools::getSession()->get('Checkout.PaymentMethod');
if ($nice && isset($methods[$method])) {
$m... | php | {
"resource": ""
} |
q257884 | OrderEmailNotifier.sendConfirmation | test | public function sendConfirmation()
{
$subject = _t(
'SilverShop\ShopEmail.ConfirmationSubject',
'Order #{OrderNo} confirmation',
'',
array('OrderNo' => $this->order->Reference)
);
return $this->sendEmail(
'SilverShop/Model/Order_Con... | php | {
"resource": ""
} |
q257885 | OrderEmailNotifier.sendAdminNotification | test | public function sendAdminNotification()
{
$subject = _t(
'SilverShop\ShopEmail.AdminNotificationSubject',
'Order #{OrderNo} notification',
'',
array('OrderNo' => $this->order->Reference)
);
$email = $this->buildEmail('SilverShop/Model/Order_Ad... | php | {
"resource": ""
} |
q257886 | OrderEmailNotifier.sendCancelNotification | test | public function sendCancelNotification()
{
$email = Email::create()
->setSubject(_t(
'SilverShop\ShopEmail.CancelSubject',
'Order #{OrderNo} cancelled by member',
'',
['OrderNo' => $this->order->Reference]
))
... | php | {
"resource": ""
} |
q257887 | ShoppingCartController.build_url | test | protected static function build_url($action, $buyable, $params = [])
{
if (!$action || !$buyable) {
return false;
}
if (SecurityToken::is_enabled() && !self::config()->disable_security_token) {
$params[SecurityToken::inst()->getName()] = SecurityToken::inst()->getVal... | php | {
"resource": ""
} |
q257888 | ShoppingCartController.direct | test | public static function direct($status = true)
{
if (Director::is_ajax()) {
return (string)$status;
}
if (self::config()->direct_to_cart_page && ($cartlink = CartPage::find_link())) {
return Controller::curr()->redirect($cartlink);
} else {
return C... | php | {
"resource": ""
} |
q257889 | ShoppingCartController.index | test | public function index()
{
if ($cart = $this->Cart()) {
return $this->redirect($cart->CartLink);
} elseif ($response = ErrorPage::response_for(404)) {
return $response;
}
return $this->httpError(404, _t('SilverShop\Cart\ShoppingCart.NoCartInitialised', 'no cart... | php | {
"resource": ""
} |
q257890 | ShoppingCartController.debug | test | public function debug()
{
if (Director::isDev() || Permission::check('ADMIN')) {
//TODO: allow specifying a particular id to debug
Requirements::css('silvershop/core: client/dist/css/cartdebug.css');
$order = ShoppingCart::curr();
$content = ($order)
... | php | {
"resource": ""
} |
q257891 | MatchObjectFilter.getFilter | test | public function getFilter()
{
if (!is_array($this->data)) {
return null;
}
$allowed = array_keys(DataObject::getSchema()->databaseFields($this->className));
$fields = array_flip(array_intersect($allowed, $this->required));
$singleton = singleton($this->className);... | php | {
"resource": ""
} |
q257892 | ShopAccountForm.submit | test | public function submit($data, $form, $request)
{
$member = Security::getCurrentUser();
if (!$member) {
return false;
}
$form->saveInto($member);
$member->write();
$form->sessionMessage(_t(__CLASS__ . '.DetailsSaved', 'Your details have been saved'), 'good... | php | {
"resource": ""
} |
q257893 | ShopAccountForm.proceed | test | public function proceed($data, $form, $request)
{
$member = Security::getCurrentUser();
if (!$member) {
return false;
}
$form->saveInto($member);
$member->write();
$form->sessionMessage(_t(__CLASS__ . '.DetailsSaved', 'Your details have been saved'), 'goo... | php | {
"resource": ""
} |
q257894 | OrderTotalCalculator.getModifier | test | public function getModifier($className, $forcecreate = false)
{
if (!ClassInfo::exists($className)) {
user_error("Modifier class \"$className\" does not exist.");
}
//search for existing
$modifier = $className::get()
->filter("OrderID", $this->order->ID)
... | php | {
"resource": ""
} |
q257895 | OrderItem.UnitPrice | test | public function UnitPrice()
{
if ($this->Order()->IsCart()) {
$buyable = $this->Buyable();
$unitprice = ($buyable) ? $buyable->sellingPrice() : $this->UnitPrice;
$this->extend('updateUnitPrice', $unitprice);
return $this->UnitPrice = $unitprice;
}
... | php | {
"resource": ""
} |
q257896 | OrderItem.calculatetotal | test | protected function calculatetotal()
{
$total = $this->UnitPrice() * $this->Quantity;
$this->extend('updateTotal', $total);
$this->CalculatedTotal = $total;
return $total;
} | php | {
"resource": ""
} |
q257897 | OrderItem.uniquedata | test | public function uniquedata()
{
$required = self::config()->required_fields; //TODO: also combine with all ancestors of this->class
$unique = [];
$hasOnes = $this->hasOne();
//reduce record to only required fields
if ($required) {
foreach ($required as $field) {
... | php | {
"resource": ""
} |
q257898 | OrderItem.onBeforeWrite | test | public function onBeforeWrite()
{
parent::onBeforeWrite();
if ($this->OrderID && $this->Order() && $this->Order()->isCart()) {
$this->calculatetotal();
}
} | php | {
"resource": ""
} |
q257899 | OrderItem.ProductVariation | test | public function ProductVariation($forcecurrent = false)
{
if ($this->ProductVariationID && $this->ProductVariationVersion && !$forcecurrent) {
return Versioned::get_version(
Variation::class,
$this->ProductVariationID,
$this->ProductVariationVersio... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.