_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q263600
CFDIFactory.newPostValidator
test
public function newPostValidator(): PostValidator { $postvalidator = new PostValidator(); $postvalidator->validators->append(new Validators\TFDVersions()); $postvalidator->validators->append(new Validators\Impuestos()); $postvalidator->validators->append(new Validators\Fechas()); ...
php
{ "resource": "" }
q263601
CFDIFactory.newRetriever
test
public function newRetriever(DownloaderInterface $downloader = null) { $localResourcesPath = $this->getLocalResourcesPath(); if ('' === $localResourcesPath) { return null; } return new XsdRetriever($localResourcesPath, $downloader); }
php
{ "resource": "" }
q263602
CFDIFactory.newXsltRetriever
test
public function newXsltRetriever(DownloaderInterface $downloader = null) { $localResourcesPath = $this->getLocalResourcesPath(); if ('' === $localResourcesPath) { return null; } return new XsltRetriever($localResourcesPath, $downloader); }
php
{ "resource": "" }
q263603
CFDIFactory.newCertificadoValidator
test
public function newCertificadoValidator(): CertificadoValidator { $validator = new CertificadoValidator(); $validator->setCadenaOrigen($this->newCadenaOrigen()); $validator->setXsltRetriever($this->newXsltRetriever()); return $validator; }
php
{ "resource": "" }
q263604
CFDIFactory.newCFDIReader
test
public function newCFDIReader( string $content, array &$errors = [], array &$warnings = [], bool $requireTimbre = true ): CFDIReader { // before creation $schemaValidator = $this->newSchemasValidator(); $schemaValidator->validate($content); // creatio...
php
{ "resource": "" }
q263605
CommandBus.handle
test
public function handle(CommandInterface $command) { if (!$commandHandler = $this->handlerResolver->resolve($command)) { throw new HandlerNotFoundException(); } $commandHandler->handle($command); }
php
{ "resource": "" }
q263606
Cookies.set
test
public function set($name, $value, $minutes = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) { $expire = ($minutes == 0) ? 0 : time() + ($minutes * 60); $cookie = new Cookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); $this->cookies[$name] = $cookie; ...
php
{ "resource": "" }
q263607
Cookies.get
test
public function get($name, $default = null) { if (null !== ($value = $this->request->cookies->get($name))) { return $value ?: $default; } return $default; }
php
{ "resource": "" }
q263608
Arr.firstBy
test
public static function firstBy(array $array, Closure $closure) { foreach ($array as $key => $value) { if (true === call_user_func_array($closure, array($key, $value))) { return $value; } } return null; }
php
{ "resource": "" }
q263609
BCryptPasswordEncoder.isPasswordValid
test
public function isPasswordValid($encodedPassword, $rawPassword, $salt) { return ! $this->isPasswordTooLong($rawPassword) && password_verify($rawPassword, $encodedPassword); }
php
{ "resource": "" }
q263610
CFDIReader.node
test
public function node(...$nodePath) { $node = $this->retrieveNode(...$nodePath); return (null === $node) ? null : clone $node; }
php
{ "resource": "" }
q263611
CFDIReader.attribute
test
public function attribute(string ...$nodePath): string { // cast to string since array_pop can return NULL $attribute = (string) array_pop($nodePath); $node = $this->retrieveNode(...$nodePath); return (null !== $node) ? (string) $node[$attribute] : ''; }
php
{ "resource": "" }
q263612
CFDIReader.appendChild
test
private function appendChild(SimpleXMLElement $source, SimpleXMLElement $parent, array $nss): SimpleXMLElement { $new = $parent->addChild($this->normalizeName($source->getName()), (string) $source); $this->populateNode($source, $new, $nss); return $new; }
php
{ "resource": "" }
q263613
CFDIReader.populateNode
test
private function populateNode(SimpleXMLElement $source, SimpleXMLElement $destination, array $nss) { // populate attributes foreach ($nss as $ns) { foreach ($source->attributes($ns) as $attribute) { /* @var $attribute SimpleXMLElement */ $destination->addA...
php
{ "resource": "" }
q263614
CFDIReader.retrieveNode
test
private function retrieveNode(string ...$nodePath) { $node = $this->comprobante; foreach ($nodePath as $level) { if (! isset($node->{$level})) { return null; } $node = $node->{$level}; } return $node; }
php
{ "resource": "" }
q263615
AbstractRequired.hasRequiredValue
test
protected function hasRequiredValue($value) { $valid = true; // $_FILES if ($value instanceof UploadedFile && !$value->isValid()) { $valid = false; } // Null else if (is_null($value)) { $valid = false; } // String else ...
php
{ "resource": "" }
q263616
Profiler.addDoctrineQueries
test
public function addDoctrineQueries(DebugStack $debugStack) { foreach ($debugStack->queries as $query) { if (!$query['params']) { $query['params'] = array(); } if (!$query['types']) { $query['types'] = array(); } /...
php
{ "resource": "" }
q263617
Profiler.addTimers
test
public function addTimers($timers = array()) { foreach ($timers as $name => $timer) { $this->timers[$name] = $timer; } return $this; }
php
{ "resource": "" }
q263618
Profiler.getFileSize
test
protected function getFileSize($size) { $units = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); return round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$units[$i]; }
php
{ "resource": "" }
q263619
Validators.append
test
public function append(ValidatorInterface $validator) { if (false === $this->getIndex($validator)) { $this->validators[] = $validator; } }
php
{ "resource": "" }
q263620
Validators.remove
test
public function remove(ValidatorInterface $validator) { $index = $this->getIndex($validator); if (false !== $index) { unset($this->validators[$index]); $this->validators = array_values($this->validators); } }
php
{ "resource": "" }
q263621
Validators.get
test
public function get($index) { if (! array_key_exists($index, $this->validators)) { throw new \OutOfBoundsException('Validator does not exists'); } return $this->validators[$index]; }
php
{ "resource": "" }
q263622
Validate.make
test
public static function make(array $arguments): self { if (! count($arguments)) { throw new \InvalidArgumentException('Cannot construct without arguments'); } $script = array_shift($arguments); $filenames = []; $localPath = null; while (null !== $argument ...
php
{ "resource": "" }
q263623
Validate.run
test
public function run() { $factory = new CFDIFactory($this->localPath); foreach ($this->filenames as $filename) { $this->runFilename($factory, $filename); } }
php
{ "resource": "" }
q263624
Validate.runFilename
test
protected function runFilename(CFDIFactory $factory, string $argument) { if ('' === $argument) { $this->error('FATAL: Empty filename'); return; } $filename = realpath($argument); if ('' === $filename || ! is_file($filename) || ! is_readable($filename)) { ...
php
{ "resource": "" }
q263625
AuthenticationProvider.authorize
test
public function authorize(CredentialsInterface $credentials) { // Check if user can be found if ( ! $user = $this->userProvider->findUserByUsername($credentials->getUsername())) { throw new UserNotFoundException(sprintf('User "%s" not found', $credentials->getUsername())); } ...
php
{ "resource": "" }
q263626
AuthenticationProvider.isLoggedIn
test
public function isLoggedIn() { if (null === $this->loggedIn) { $this->user = $this->loadUser(); $this->loggedIn = $this->user instanceof UserInterface; } return $this->loggedIn; }
php
{ "resource": "" }
q263627
AuthenticationProvider.login
test
public function login(UserInterface $user) { // Check if user can be found. // Stops trying to login a user that hasn't been added to database yet if ( ! $this->userProvider->findUserByUsername($user->getUsername())) { throw new UserNotFoundException(sprintf('User "%s" not found'...
php
{ "resource": "" }
q263628
AuthenticationProvider.logout
test
public function logout() { $this->storage->removeIdentifier($this->storageKey); $this->user = null; $this->loggedIn = false; }
php
{ "resource": "" }
q263629
Validator.add
test
public function add($name, $constraints) { if ( ! isset($this->constraints[$name])) { $this->constraints[$name] = []; } if (!is_array($constraints)) { $constraints = array($constraints); } foreach ($constraints as $constraint) { $this->co...
php
{ "resource": "" }
q263630
Validator.validate
test
public function validate($input) { $this->messages = []; $this->input = $input; /** * @var ConstraintInterface $constraint */ foreach ($this->constraints as $field => $constraints) { foreach ($constraints as $constraint) { // If value i...
php
{ "resource": "" }
q263631
RedirectController.urlRedirectAction
test
public function urlRedirectAction(Request $request, $path, $permanent = false, $scheme = null, $httpPort = null, $httpsPort = null) { /** @var ConfigInterface $config */ $config = $this->container->get('config'); if ('' == $path) { throw new HttpException($permanent ? 410 : 404)...
php
{ "resource": "" }
q263632
Bundle.getPath
test
public function getPath() { if (null === $this->path) { $reflected = new \ReflectionObject($this); $this->path = dirname($reflected->getFileName()); } return $this->path; }
php
{ "resource": "" }
q263633
Messages.get
test
public function get(int $index): string { if (! array_key_exists($index, $this->messages)) { throw new \OutOfBoundsException('Message does not exists'); } return $this->messages[$index]; }
php
{ "resource": "" }
q263634
CustomPostType.generateCustomPostTypeName
test
protected function generateCustomPostTypeName() { $matches = []; preg_match('@(\\\\)?([\w]+)$@', get_called_class(), $matches); $cptName = strtolower( preg_replace('/(?<=\\w)(?=[A-Z])/', "-$1", $matches[2]) ); return $cptName; }
php
{ "resource": "" }
q263635
UrlExtension.getFunctions
test
public function getFunctions() { return array( new \Twig_SimpleFunction('base_url', array($this, 'getBaseUrl')), new \Twig_SimpleFunction('current_url', array($this, 'getCurrentUrl')), new \Twig_SimpleFunction('asset_url', array($this, 'asset')), new \Twig_Sim...
php
{ "resource": "" }
q263636
CommandHandlerResolver.resolve
test
public function resolve(CommandInterface $command) { $handlerClass = $this->getHandlerClass($command); try { $handler = $this->container->get($handlerClass); return $handler; } catch(\Exception $e) { return null; } }
php
{ "resource": "" }
q263637
AbstractValidator.setup
test
protected function setup(CFDIReader $cfdi, Issues $issues) { $this->errors = $issues->messages(IssuesTypes::ERROR); $this->warnings = $issues->messages(IssuesTypes::WARNING); $this->comprobante = $cfdi->comprobante(); }
php
{ "resource": "" }
q263638
AbstractValidator.sumNodes
test
protected function sumNodes(SimpleXMLElement $collection = null, $attribute = '') { if (null === $collection) { return 0; } $sum = 0; if ('' === $attribute) { foreach ($collection as $node) { $sum = $sum + $this->value($node); } ...
php
{ "resource": "" }
q263639
OldInputBag.get
test
public function get($name, $default = null) { if ( ! $this->has($name)) { return $default; } $return = $this->oldInput[$name]; unset($this->oldInput[$name]); return $return; }
php
{ "resource": "" }
q263640
CustomTaxonomy.setSequentialPosition
test
public function setSequentialPosition($position, MetaDataBinding $context) { add_action('do_meta_boxes', function ($post_type) use ($position, $context) { global $wp_meta_boxes; if ($context->getBindingName() !== $post_type) { return; } forea...
php
{ "resource": "" }
q263641
CustomTaxonomy.generateTaxonomyName
test
protected function generateTaxonomyName() { $matches = []; preg_match('@\\\\([\w]+)$@', get_called_class(), $matches); $taxonomyName = strtolower( preg_replace('/(?<=\\w)(?=[A-Z])/', "-$1", $matches[1]) ); // Use the existing WordPress taxonomy post_tag with an u...
php
{ "resource": "" }
q263642
RedirectableUrlMatcher.redirect
test
public function redirect($path, $route, $scheme = null) { return [ '_controller' => 'Tomahawk\\Routing\\Controller\\RedirectController::urlRedirectAction', 'path' => $path, 'permanent' => true, 'scheme' => $scheme, 'httpPort' => $this->context->get...
php
{ "resource": "" }
q263643
Application.registerCommands
test
protected function registerCommands() { if ($this->commandsRegistered) { return; } $this->commandsRegistered = true; $this->kernel->boot(); foreach ($this->kernel->getBundles() as $bundle) { if ($bundle instanceof Bundle) { $bundle->...
php
{ "resource": "" }
q263644
DisconnectedMetadataFactory.getBundleMetadata
test
public function getBundleMetadata(BundleInterface $bundle) { $namespace = $bundle->getNamespace(); $metadata = $this->getMetadataForNamespace($namespace); if (!$metadata->getMetadata()) { throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bu...
php
{ "resource": "" }
q263645
DisconnectedMetadataFactory.getNamespaceMetadata
test
public function getNamespaceMetadata($namespace, $path = null) { $metadata = $this->getMetadataForNamespace($namespace); if (!$metadata->getMetadata()) { throw new \RuntimeException(sprintf('Namespace "%s" does not contain any mapped entities.', $namespace)); } $this->fi...
php
{ "resource": "" }
q263646
DisconnectedMetadataFactory.findNamespaceAndPathForMetadata
test
public function findNamespaceAndPathForMetadata(ClassMetadataCollection $metadata, $path = null) { $all = $metadata->getMetadata(); if (class_exists($all[0]->name)) { $r = new \ReflectionClass($all[0]->name); $path = $this->getBasePathForClass($r->getName(), $r->getNamespaceN...
php
{ "resource": "" }
q263647
AssetContainer.add
test
protected function add($type, $name, $source, $dependencies, $attributes) { $dependencies = (array) $dependencies; $attributes = (array) $attributes; $this->assets[$type][$name] = compact('source', 'dependencies', 'attributes'); return $this; }
php
{ "resource": "" }
q263648
Controller.render
test
public function render($view, array $parameters = [], Response $response = null) { $content = $this->renderView($view, $parameters); if (null === $response) { $response = new Response(); } $response->setContent($content); return $response; }
php
{ "resource": "" }
q263649
CacheManager.save
test
public function save($id, $value, $lifetime = false) { $this->cacheProvider->save($id, $value, $lifetime); }
php
{ "resource": "" }
q263650
CFDICleaner.loadContent
test
public function loadContent(string $content) { // run this method with libxml internal errors enabled if (true !== libxml_use_internal_errors(true)) { try { $this->loadContent($content); } finally { libxml_use_internal_errors(false); ...
php
{ "resource": "" }
q263651
CFDICleaner.removeNonSatNSschemaLocations
test
public function removeNonSatNSschemaLocations() { $xsi = $this->dom->lookupPrefix('http://www.w3.org/2001/XMLSchema-instance'); if (! $xsi) { return; } $schemaLocations = $this->xpathQuery("//@$xsi:schemaLocation"); if ($schemaLocations->length === 0) { ...
php
{ "resource": "" }
q263652
CFDICleaner.removeNonSatNSNodes
test
public function removeNonSatNSNodes() { $nss = []; foreach ($this->xpathQuery('//namespace::*') as $node) { $namespace = $node->nodeValue; if ($this->isNameSpaceAllowed($namespace)) { continue; } $nss[] = $namespace; } i...
php
{ "resource": "" }
q263653
CFDICleaner.removeUnusedNamespaces
test
public function removeUnusedNamespaces() { $nss = []; foreach ($this->xpathQuery('//namespace::*') as $node) { $namespace = $node->nodeValue; if (! $namespace || $this->isNameSpaceAllowed($namespace)) { continue; } $prefix = $this->dom-...
php
{ "resource": "" }
q263654
View.initializeBindings
test
protected function initializeBindings() { if (!$this->getMetaDataBinding()) { $siteClass = get_class($this->site); if ($binding = $siteClass::getPost()) { $this->setMetaDataBinding($binding); } } $this->bindRegistryItems(); }
php
{ "resource": "" }
q263655
View.bindRegistryItems
test
protected function bindRegistryItems() { foreach ($this->registry as $registerable) { if ($registerable instanceof DelegatesMetaDataBinding) { $registerable->setMetaDataBinding($this->getMetaDataBinding()); } } }
php
{ "resource": "" }
q263656
View.getFileNameDashedCase
test
public function getFileNameDashedCase() { $calledClass = preg_replace('/.*Views/i', '', get_called_class()); $calledClass = strtolower( preg_replace('/(?<=\\w)(?=[A-Z])/', '-$1', $calledClass) ); return str_replace('\\', DIRECTORY_SEPARATOR, $calledClass); }
php
{ "resource": "" }
q263657
View.initializeContext
test
private function initializeContext() { $this->context = Timber\Timber::get_context(); $this->context['page'] = $this; $this->context['post'] = $this->getMetaDataBinding(); $this->context = $this->configureContext($this->context); foreach ($this->contextRegistry as $key => ...
php
{ "resource": "" }
q263658
View.render
test
public function render() { $this->initializeBindings(); return Timber\Timber::compile($this->getTemplate(), $this->initializeContext()); }
php
{ "resource": "" }
q263659
ConfigManager.load
test
public function load($force = false) { $this->config = array(); // Check if we have a compiled cached file if ( ! $force && $this->cacheFile && file_exists($this->cacheFile)) { $this->config = include($this->cacheFile); return; } foreach ($this->conf...
php
{ "resource": "" }
q263660
Router.match
test
public function match($path, $name, $callback = null, array $schemes = []) { return $this->any($path, $name, $callback, $schemes); }
php
{ "resource": "" }
q263661
Router.section
test
public function section($name, $options = [], \Closure $callback) { $sub_collection = new RouteCollection(); $sub_router = new self(); $sub_router->setInSection(true); $sub_router->setRoutes($sub_collection); $callback($sub_router, $sub_collection); $sub_collection...
php
{ "resource": "" }
q263662
Router.group
test
public function group($options, \Closure $callback) { $prefix = null; if ( ! (is_string($options) || is_array($options))) { throw new \RuntimeException('Options must either be a string or array'); } if (is_string($options)) { $prefix = $options; ...
php
{ "resource": "" }
q263663
BlocksHelper.start
test
public function start($name) { if (in_array($name, $this->openBlocks)) { throw new \InvalidArgumentException(sprintf('A block named "%s" is already started.', $name)); } $this->openBlocks[] = $name; $this->blocks[$name] = ''; ob_start(); ob_implicit_flus...
php
{ "resource": "" }
q263664
BlocksHelper.stop
test
public function stop() { if (!$this->openBlocks) { throw new \LogicException('No block started.'); } $name = array_pop($this->openBlocks); $this->blocks[$name] = ob_get_clean(); }
php
{ "resource": "" }
q263665
BlocksHelper.output
test
public function output($name, $default = false) { if (isset($this->blocks[$name])) { echo $this->blocks[$name]; return true; } if (isset($this->blockDefaults[$name])) { echo $this->blockDefaults[$name]; return true; } if (...
php
{ "resource": "" }
q263666
ControllerResolver.createController
test
protected function createController($controller) { if (false === strpos($controller, '::')) { $count = substr_count($controller, ':'); if (2 == $count && $this->parser) { // controller in the a:b:c notation then $controller = $this->parser->parse($cont...
php
{ "resource": "" }
q263667
ControllerResolver.instantiateController
test
protected function instantiateController($class) { $reflector = new ReflectionClass($class); $constructor = $reflector->getConstructor(); if ($constructor && $constructor->getParameters()) { $controller = $this->container->get($class); } else { $cont...
php
{ "resource": "" }
q263668
UrlGenerator.validateUrl
test
public function validateUrl($url) { foreach ($this->validUrlStartChars as $char) { if (0 === strpos($url, $char)) { return true; } } return false !== filter_var($url, FILTER_VALIDATE_URL); }
php
{ "resource": "" }
q263669
FilesystemLoader.findTemplate
test
protected function findTemplate($template, $throw = true) { $logicalName = (string) $template; if (isset($this->cache[$logicalName])) { return $this->cache[$logicalName]; } $file = null; try { $file = parent::findTemplate($logicalName); } cat...
php
{ "resource": "" }
q263670
CommandHelper.setApplicationEntityManager
test
static public function setApplicationEntityManager(Application $application, $emName) { /** @var $em \Doctrine\ORM\EntityManager */ $em = $application->getKernel()->getContainer()->get('doctrine')->getManager($emName); $helperSet = $application->getHelperSet(); $helperSet->set(new C...
php
{ "resource": "" }
q263671
CommandHelper.setApplicationConnection
test
static public function setApplicationConnection(Application $application, $connName) { $connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName); $helperSet = $application->getHelperSet(); $helperSet->set(new ConnectionHelper($connection), 'db'); ...
php
{ "resource": "" }
q263672
Site.renderView
test
public function renderView($template) { if (array_key_exists($template, $this->views)) { echo $this->views[$template]->render(); return false; } return $template; }
php
{ "resource": "" }
q263673
Form.open
test
public function open() { $attributes = [ 'method' => $this->method, 'action' => $this->url ]; $attributes = array_merge($attributes, $this->attributes); return sprintf('<form%s>', $this->attributes($attributes)); }
php
{ "resource": "" }
q263674
Form.addTransformers
test
public function addTransformers(array $dataTransformers) { foreach ($dataTransformers as $type => $dataTransformer) { if ( ! $dataTransformer instanceof DataTransformerInterface) { throw new InvalidDataTransformerException(); } $this->addTransformer($typ...
php
{ "resource": "" }
q263675
Client.public
test
function public ($segment, array $parameters=[], $version='v1.1') { $options = [ 'http' => [ 'method' => 'GET', 'timeout' => 10, ], ]; $publicUrl = $this->getPublicUrl($version); $url = $publicUrl . $segment . '?' . http_build_que...
php
{ "resource": "" }
q263676
Client.market
test
public function market($segment, array $parameters=[]) { $baseUrl = $this->marketUrl; return $this->nonPublicRequest($baseUrl, $segment, $parameters); }
php
{ "resource": "" }
q263677
Client.account
test
public function account($segment, array $parameters=[]) { $baseUrl = $this->accountUrl; return $this->nonPublicRequest($baseUrl, $segment, $parameters); }
php
{ "resource": "" }
q263678
Meta.prepareAttributes
test
public static function prepareAttributes(array $attributes) { return [ 'title' => Arr::get($attributes, 'title'), 'description' => Arr::get($attributes, 'description'), 'keywords' => Arr::get($attributes, 'keywords', []), 'extras' => Arr::get($at...
php
{ "resource": "" }
q263679
Meta.addExtra
test
public function addExtra($key, $value) { return $this->setExtras( $this->extras->put($key, $value)->all() ); }
php
{ "resource": "" }
q263680
RecordSet.fetchObject
test
function fetchObject($className = '\\stdClass', $params = array()) { if ($className) { if ($params) { return mysqli_fetch_object($this->result, $className, $params); } else { return mysqli_fetch_object($this->result, $className); } ...
php
{ "resource": "" }
q263681
UI.dialog
test
static function dialog($openControlId, $message, array $action = array()) { Manialink::appendScript(static::getDialog($openControlId, $message, $action)); }
php
{ "resource": "" }
q263682
Connection.getInstance
test
static function getInstance() { if (\array_key_exists('default', static::$connections)) { return static::$connections['default']; } $config = Config::getInstance(); $params = new ConnectionParams(); $params->id = 'default'; $params->host = $config->host;...
php
{ "resource": "" }
q263683
Connection.beginTransaction
test
function beginTransaction() { if ($this->transactionRollback) { throw new Exception('Transaction must be rollback\'ed!'); } if ($this->transactionRefCount === null) { $this->execute('BEGIN'); $this->transactionRefCount = 1; } else { $th...
php
{ "resource": "" }
q263684
Maniacode.load
test
final public static function load($noconfirmation = false, $createManialinkElement = true) { self::$domDocument = new \DOMDocument('1.0', 'utf8'); self::$parentNodes = array(); if ($createManialinkElement) { $maniacode = self::$domDocument->...
php
{ "resource": "" }
q263685
Maniacode.render
test
final public static function render($return = false) { if ($return) { return self::$domDocument->saveXML(); } else { header('Content-Type: text/xml; charset=utf-8'); echo self::$domDocument->saveXML(); exit(); } }
php
{ "resource": "" }
q263686
Client.connect
test
public function connect(){ $this->stream = stream_socket_client('tcp://'.$this->host.':'.$this->port, $errno, $errstr, 10); if(!$this->stream){ throw new Exception("Error $errno : $errstr"); } return fgets($this->stream); }
php
{ "resource": "" }
q263687
Client.watch
test
public function watch($enable = true, $format = 'json'){ if($enable){ fwrite($this->stream, '?WATCH={"enable":true,"'.$format.'":true}'); }else{ fwrite($this->stream, '?WATCH={"enable":false}'); } }
php
{ "resource": "" }
q263688
Element.setBgcolor
test
function setBgcolor($bgcolor) { $this->bgcolor = $bgcolor; $this->setStyle(null); $this->setSubStyle(null); }
php
{ "resource": "" }
q263689
Element.setImage
test
function setImage($image, $absoluteUrl = false) { $this->setStyle(null); $this->setSubStyle(null); if (!$absoluteUrl) { $this->image = Manialink::$imagesURL . $image; } else { $this->image = $image; } }
php
{ "resource": "" }
q263690
Element.setImageid
test
function setImageid($imageid) { $this->setStyle(null); $this->setSubStyle(null); $this->imageid = $imageid; }
php
{ "resource": "" }
q263691
Element.setImageFocus
test
function setImageFocus($imageFocus, $absoluteUrl = false) { $this->setStyle(null); $this->setSubStyle(null); if (!$absoluteUrl) { $this->imageFocus = Manialink::$imagesURL . $imageFocus; } else { $this->imageFocus = $imageFocus; } }
php
{ "resource": "" }
q263692
Element.setImageFocusid
test
function setImageFocusid($imageFocusid) { $this->setStyle(null); $this->setSubStyle(null); $this->imageFocusid = $imageFocusid; }
php
{ "resource": "" }
q263693
Element.addLink
test
function addLink(\ManiaLib\Gui\Element $object) { $this->manialink = $object->getManialink(); $this->url = $object->getUrl(); $this->maniazone = $object->getManiazone(); $this->goto = $object->getGoto(); $this->action = $object->getAction(); $this->actionKey = $object...
php
{ "resource": "" }
q263694
Seo.getConfig
test
public static function getConfig($key = null, $default = null) { $key = self::KEY.(is_null($key) ? '' : '.'.$key); return config()->get($key, $default); }
php
{ "resource": "" }
q263695
Seo.setConfig
test
public static function setConfig($key, $value = null) { config()->set(self::KEY.'.'.$key, $value); }
php
{ "resource": "" }
q263696
Seo.getTrans
test
public static function getTrans($key = null, $replace = [], $locale = null) { return trans(self::KEY.'::'.$key, $replace, $locale); }
php
{ "resource": "" }
q263697
Collection.getArray
test
public function getArray($key, callable $callback = null) { $list = $this->get($key); if (!is_array($list)) { return []; } if (is_callable($callback)) { return array_map($callback, $list); } return $list; }
php
{ "resource": "" }
q263698
Formatting.stripStyles
test
static function stripStyles($string) { $string = preg_replace('/(?<!\$)((?:\$\$)*)\$[^$0-9a-hlp]/iu', '$1', $string); $string = self::stripLinks($string); $string = self::stripColors($string); return $string; }
php
{ "resource": "" }
q263699
Redirect.createOne
test
public static function createOne($oldUrl, $newUrl, $status = Response::HTTP_MOVED_PERMANENTLY) { $redirect = new self([ 'old_url' => $oldUrl, 'new_url' => $newUrl, 'status' => $status, ]); $redirect->save(); return $redirect; }
php
{ "resource": "" }