_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q12900 | PhpProjectType.resolveDatabaseImportPath | train | protected function resolveDatabaseImportPath($import_path = null)
{
if (!isset($import_path)) {
$import_path = $this->doAsk(
new Question(
'Input the path to the database file: '
)
);
if (!file_exists($import_path)) {
throw new \Exception(
| php | {
"resource": ""
} |
q12901 | PhpProjectType.resolveDatabaseImportDestination | train | protected function resolveDatabaseImportDestination($import_path, $service, $copy_to_service = false, $localhost = false)
{
/** @var \SplFileInfo $import_path */
$path = $this->resolveDatabaseImportPath($import_path);
$filename = $path->getFilename();
$extract_filename = substr($filename, 0, strrpos($filename, '.'));
if (!$localhost) {
// Copy file to service if uploaded from localhost.
if ($copy_to_service) {
| php | {
"resource": ""
} |
q12902 | PhpProjectType.resolveDatabaseServiceInstance | train | protected function resolveDatabaseServiceInstance($service = null)
{
/** @var EngineType $engine */
$engine = $this->getEngineInstance();
$services = $engine->getServiceInstanceByGroup('database');
if (!isset($service) || !isset($services[$service])) {
if (count($services) > 1) {
$options = array_keys($services);
$service = $this->doAsk(
new ChoiceQuestion(
'Select the database service to use for import: ',
$options
)
);
| php | {
"resource": ""
} |
q12903 | PhpProjectType.resolveDatabaseImportCommand | train | protected function resolveDatabaseImportCommand($service = null)
{
/** @var ServiceDbInterface $instance */
$instance = $this->resolveDatabaseServiceInstance($service);
/** @var DatabaseInterface $database */
$database = $this->getDatabaseInfo($instance);
switch ($database->getProtocol()) {
case 'mysql':
return (new MysqlCommand())
->host($database->getHostname())
->username($database->getUser())
->password($database->getPassword())
| php | {
"resource": ""
} |
q12904 | PhpProjectType.hasDatabaseConnection | train | protected function hasDatabaseConnection($host, $port = 3306, $seconds = 30)
{
$hostChecker = $this->getHostChecker();
| php | {
"resource": ""
} |
q12905 | PhpProjectType.getServiceInstanceDatabase | train | protected function getServiceInstanceDatabase(ServiceDbInterface $instance)
{
$port = current($instance->getHostPorts());
return (new Database($this->databaseInfoMapping()))
->setPort($port)
->setUser($instance->username())
| php | {
"resource": ""
} |
q12906 | PhpProjectType.mergeProjectComposerTemplate | train | protected function mergeProjectComposerTemplate()
{
if ($contents = $this->loadTemplateContents('composer.json', 'json')) | php | {
"resource": ""
} |
q12907 | PhpProjectType.setupComposerPackages | train | protected function setupComposerPackages()
{
$platform = $this->getPlatformInstance();
if ($platform instanceof | php | {
"resource": ""
} |
q12908 | PhpProjectType.composer | train | private function composer()
{
$composer_file = $this->composerFile();
return file_exists($composer_file)
| php | {
"resource": ""
} |
q12909 | ShoppingCart.setAvailablePostage | train | public function setAvailablePostage($country, $code)
{
$postage_areas = new ShippingCalculator($code, $country);
$postage_areas
->setCost($this->SubTotalCost)
->setWeight($this->TotalWeight)
->setItems($this->TotalItems);
| php | {
"resource": ""
} |
q12910 | ShoppingCart.isCollection | train | public function isCollection()
{
if (Checkout::config()->click_and_collect) {
$type = Session::get("Checkout.Delivery");
| php | {
"resource": ""
} |
q12911 | ShoppingCart.isDeliverable | train | public function isDeliverable()
{
$deliverable = false;
foreach ($this->getItems() as $item) {
if ($item->Deliverable) {
| php | {
"resource": ""
} |
q12912 | ShoppingCart.emptycart | train | public function emptycart()
{
$this->extend("onBeforeEmpty");
$this->removeAll();
$this->save();
$this->setSessionMessage(
| php | {
"resource": ""
} |
q12913 | ShoppingCart.save | train | public function save()
{
Session::clear("Checkout.PostageID");
// Extend our save operation
$this->extend("onBeforeSave");
// Save cart items
Session::set(
"Checkout.ShoppingCart.Items",
serialize($this->items)
);
// Save cart discounts
Session::set(
"Checkout.ShoppingCart.Discount",
serialize($this->discount)
);
| php | {
"resource": ""
} |
q12914 | ShoppingCart.getSubTotalCost | train | public function getSubTotalCost()
{
$total = 0;
foreach ($this->items as $item) {
| php | {
"resource": ""
} |
q12915 | ShoppingCart.getDiscountAmount | train | public function getDiscountAmount()
{
$total = 0;
$discount = 0;
foreach ($this->items as $item) {
if ($item->Price) {
$total += ($item->Price * $item->Quantity);
}
| php | {
"resource": ""
} |
q12916 | ShoppingCart.doAddDiscount | train | public function doAddDiscount($data, $form)
{
$code_to_search = $data['DiscountCode'];
// First check if the discount is already added (so we don't
// query the DB if we don't have to).
if (!$this->discount || ($this->discount && $this->discount->Code != $code_to_search)) {
$code = Discount::get()
| php | {
"resource": ""
} |
q12917 | ShoppingCart.doSetPostage | train | public function doSetPostage($data, $form)
{
$country = $data["Country"];
$code = $data["ZipCode"];
$this->setAvailablePostage($country, $code);
$postage = Session::get("Checkout.AvailablePostage");
// Check that postage is set, if not, see if we can set a default
if (array_key_exists("PostageID", $data) && $data["PostageID"]) {
// First is the current postage ID in the list of postage
// areas
if ($postage && $postage->exists() && $postage->find("ID", $data["PostageID"])) {
$id = $data["PostageID"];
} else {
$id = $postage->first()->ID;
}
$data["PostageID"] = $id;
Session::set("Checkout.PostageID", $id);
} else {
// Finally set the default postage
| php | {
"resource": ""
} |
q12918 | BaseWebUserContext.iFillTheUiSelectWithAndSelectElement2 | train | public function iFillTheUiSelectWithAndSelectElement2($id, $item)
{
$items = explode("-", $item);
if(count($items) > 0){
$item = $items[0].'-'.((int)$items[1] - 1);
}else {
$item = "0-".((int)$item - 1);
}
$idItem = sprintf("#ui-select-choices-row-%s",$item);
$this->iClickTheElement(sprintf("#%s > div.ui-select-match.ng-scope > span",$id));
| php | {
"resource": ""
} |
q12919 | BaseWebUserContext.generatePageUrl | train | protected function generatePageUrl($route, array $parameters = array())
{
// $parts = explode(' ', trim($page), 2);
// $route = implode('_', $parts);
// $route = str_replace(' ', '_', $route);
$path = $this->generateUrl($route, $parameters);
// var_dump($this->getMinkParameter('base_url'));
// var_dump($path);
// die;
| php | {
"resource": ""
} |
q12920 | BaseWebUserContext.iWaitForTextToDisappear | train | public function iWaitForTextToDisappear($text)
{
$this->spin(function(FeatureContext $context) use ($text) {
try {
| php | {
"resource": ""
} |
q12921 | BaseWebUserContext.spin | train | public function spin($lambda, $wait = 15,$errorCallback = null)
{
$time = time();
$stopTime = $time + $wait;
while (time() < $stopTime)
{
try {
if ($lambda($this)) {
return;
}
} catch (\Exception $e) {
// do nothing
| php | {
"resource": ""
} |
q12922 | ComposerConfig.addRequires | train | public function addRequires(array $requires, $dev = false)
{
foreach ($requires as $vendor => $version) {
if (!isset($vendor) || !isset($version)) {
| php | {
"resource": ""
} |
q12923 | ComposerConfig.addRequire | train | public function addRequire($vendor, $version)
{
if (!isset($this->require[$vendor])) {
| php | {
"resource": ""
} |
q12924 | ComposerConfig.addDevRequire | train | public function addDevRequire($vendor, $version)
{
if (!isset($this->require_dev[$vendor])) {
| php | {
"resource": ""
} |
q12925 | ComposerConfig.addExtra | train | public function addExtra($key, array $options)
{
if (!isset($this->extra[$key])) {
| php | {
"resource": ""
} |
q12926 | Stats.getStat | train | public function getStat($stat)
{
if (isset($this->stats[$stat])) {
| php | {
"resource": ""
} |
q12927 | CheckoutMemberExtension.getDefaultAddress | train | public function getDefaultAddress()
{
if ($this->cached_address) {
return $this->cached_address;
} else {
$address = $this
| php | {
"resource": ""
} |
q12928 | CheckoutMemberExtension.getDiscount | train | public function getDiscount()
{
$discounts = ArrayList::create();
foreach ($this->owner->Groups() as $group) {
foreach ($group->Discounts() as $discount) {
$discounts->add($discount);
| php | {
"resource": ""
} |
q12929 | SequenceGeneratorBase.buildRef | train | public function buildRef(ItemReferenceInterface $item,array $config) {
$mask = $config['mask'];
$className = $config['className'];
$field = $config['field'];
| php | {
"resource": ""
} |
q12930 | SequenceGeneratorBase.setRef | train | public function setRef(ItemReferenceInterface $item)
{
$className = ClassUtils::getRealClass(get_class($item));
$classMap = $this->getClassMap();
if(!isset($classMap[$className])){
throw new LogicException(sprintf("No ha definido la configuracion de '%s' para generar su referencia",$className));
}
$resolver = new \Symfony\Component\OptionsResolver\OptionsResolver();
$resolver->setDefined([
"method","field","options","mask"
]);
$resolver->setDefaults([
'method' => 'buildRef',
'field' => 'ref',
| php | {
"resource": ""
} |
q12931 | SequenceGeneratorBase.setSequenceGenerator | train | function setSequenceGenerator(\Tecnocreaciones\Bundle\ToolsBundle\Service\SequenceGenerator $sequenceGenerator) {
| php | {
"resource": ""
} |
q12932 | UtilsExtension.renderTabs | train | public function renderTabs(\Tecnoready\Common\Model\Tab\Tab $tab,array $parameters = [])
{
$parameters["tab"] = $tab;
| php | {
"resource": ""
} |
q12933 | HtmlMessageContent.asPlainText | train | public function asPlainText(): string
{
return $this->text ?? $this->text = | php | {
"resource": ""
} |
q12934 | SchemaBuilder.packSchema | train | public function packSchema(): array
{
$result = [];
foreach ($this->schemas as $class => $schema) {
$item = [
//Instantiator class
ODMInterface::D_INSTANTIATOR => $schema->getInstantiator(),
//Primary collection class
ODMInterface::D_PRIMARY_CLASS => $schema->resolvePrimary($this),
//Instantiator and entity specific schema
ODMInterface::D_SCHEMA => $schema->packSchema($this),
];
| php | {
"resource": ""
} |
q12935 | SchemaBuilder.createIndexes | train | public function createIndexes()
{
foreach ($this->schemas as $class => $schema) {
if ($schema->isEmbedded()) {
continue;
}
$collection = $this->manager->database(
$schema->getDatabase()
)->selectCollection(
$schema->getCollection()
);
| php | {
"resource": ""
} |
q12936 | FileDownloader.prepare | train | private function prepare($mimeType, $baseName)
{
// Ensure that output buffering is turned off. @ - intentionally
@ob_end_clean();
// Special hack for legacy IE version
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
// Prepare required headers
$headers = array(
'Content-Type' => $mimeType,
'Content-Disposition' => sprintf('attachment; filename="%s"', rawurldecode($baseName)),
'Content-Transfer-Encoding' => 'binary',
'Accept-Ranges' => 'bytes',
| php | {
"resource": ""
} |
q12937 | FileDownloader.preload | train | private function preload($target, $alias)
{
if (!is_file($target) || !is_readable($target)) {
throw new RuntimeException('Either invalid file supplied or its not readable');
}
| php | {
"resource": ""
} |
q12938 | FileDownloader.download | train | public function download($target, $alias = null)
{
$this->preload($target, $alias);
// Count file size in bytes
$size = filesize($target);
// multipart-download and download resuming support
if (isset($_SERVER['HTTP_RANGE'])) {
list($a, $range) = explode("=", $_SERVER['HTTP_RANGE'], 2);
list($range) = explode(",", $range, 2);
list($range, $range_end) = explode("-", $range);
$range = intval($range);
if (!$range_end) {
$range_end = $size - 1;
} else {
$range_end = intval($range_end);
}
$new_length = $range_end - $range + 1;
$headers = array(
'Content-Length' => $new_length,
'Content-Range' => sprintf('bytes %s', $range - $range_end / $size)
);
$this->headerBag->setStatusCode(206)
->setPairs($headers)
| php | {
"resource": ""
} |
q12939 | AbstractController.redirectToRoute | train | final protected function redirectToRoute($route)
{
$url = $this->urlBuilder->build($route);
if ($url !== null) {
$this->response->redirect($url);
} else {
| php | {
"resource": ""
} |
q12940 | AbstractController.getQueryFilter | train | final protected function getQueryFilter(FilterableServiceInterface $service, $perPageCount, $route)
| php | {
"resource": ""
} |
q12941 | AbstractController.getOptions | train | public function getOptions($key = null)
{
if ($key == null) {
return $this->options;
| php | {
"resource": ""
} |
q12942 | AbstractController.haltOnDemand | train | final protected function haltOnDemand()
{
switch (true) {
// If at least one of below conditions is true, then $this->halt() is called
case $this->hasOption('secure') && $this->getOptions('secure') == true && !$this->request->isSecure():
case $this->hasOption('ajax') | php | {
"resource": ""
} |
q12943 | AbstractController.loadTranslationMessages | train | private function loadTranslationMessages($language)
{
// Reset any previous translations if any
$this->moduleManager->clearTranslations();
| php | {
"resource": ""
} |
q12944 | AbstractController.loadDefaultTranslations | train | private function loadDefaultTranslations()
{
$language = $this->appConfig->getLanguage();
if ($language !== null) {
| php | {
"resource": ""
} |
q12945 | AbstractController.loadTranslations | train | final protected function loadTranslations($language)
{
// Don't load the same language twice, if that's the case
if ($this->appConfig->getLanguage() !== $language) {
$this->appConfig->setLanguage($language);
| php | {
"resource": ""
} |
q12946 | AbstractController.initialize | train | final public function initialize($action)
{
$this->haltOnDemand();
// Configure view with defaults
$this->view->setModule($this->getModule())
| php | {
"resource": ""
} |
q12947 | Controllers.get | train | public static function get($controllerClass) {
if (!isset(self::$controllers[$controllerClass])) {
if (class_exists($controllerClass)) {
$reflectionClass = new ReflectionClass($controllerClass);
self::$controllers[$controllerClass] = $reflectionClass->isAbstract()? $controllerClass : (new $controllerClass);
} | php | {
"resource": ""
} |
q12948 | Manager.createLaravelDriver | train | protected function createLaravelDriver(): Sdk\Client
{
return \tap($this->createHttpClient(), function ($client) {
if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
$client->setClientId($this->config['client_id'])
| php | {
"resource": ""
} |
q12949 | MemcachedEngine.set | train | public function set($key, $value, $ttl)
{
if (!$this->memcached->set($key, $value, $ttl)) {
// If set() returns false, that means the key | php | {
"resource": ""
} |
q12950 | MemcachedEngine.get | train | public function get($key, $default = false)
{
$value = $this->memcached->get($key);
if ($this->memcached->getResultCode() == 0) {
| php | {
"resource": ""
} |
q12951 | ViewManager.setLayout | train | public function setLayout($layout, $layoutModule = null)
{
$this->layout = $layout;
| php | {
"resource": ""
} |
q12952 | ViewManager.addVariables | train | public function addVariables(array $variables)
{
foreach ($variables as | php | {
"resource": ""
} |
q12953 | ViewManager.url | train | public function url()
{
$args = func_get_args();
$controller = array_shift($args);
$url = $this->urlBuilder->createUrl($controller, $args);
if ($url === false) {
| php | {
"resource": ""
} |
q12954 | ViewManager.mapUrl | train | public function mapUrl($controller, array $args = array(), $index = | php | {
"resource": ""
} |
q12955 | ViewManager.show | train | public function show($message, $translate = true)
{
if ($translate === | php | {
"resource": ""
} |
q12956 | ViewManager.createPath | train | private function createPath($dir, $path, $module, $theme = null)
{
if ($theme !== null) {
return sprintf('%s/%s/%s/%s/%s', $path, self::TEMPLATE_PARAM_MODULES_DIR, $module, $dir, $theme);
} else {
| php | {
"resource": ""
} |
q12957 | ViewManager.createSharedThemePath | train | private function createSharedThemePath($module, $theme, $base)
{
if (is_null($theme)) {
$theme = $this->theme;
}
if (is_null($module)) {
$module = $this->module; | php | {
"resource": ""
} |
q12958 | ViewManager.createThemeUrl | train | public function createThemeUrl($module = null, $theme = null)
{
| php | {
"resource": ""
} |
q12959 | ViewManager.createThemePath | train | public function createThemePath($module = null, $theme = null)
{
| php | {
"resource": ""
} |
q12960 | ViewManager.createAssetUrl | train | public function createAssetUrl($module = null, $path = null)
{
if (is_null($module)) {
$module = $this->module;
}
| php | {
"resource": ""
} |
q12961 | ViewManager.createAssetPath | train | private function createAssetPath($path, $module, $absolute, $fromAssets)
{
$baseUrl = '';
if ($absolute === true) {
$url = $baseUrl;
} else {
$url = null;
}
// If module isn't provided, then current one used by default
if (is_null($module)) {
$module = $this->module;
}
if ($fromAssets !== false) {
$dir = self::TEMPLATE_PARAM_ASSETS_DIR;
| php | {
"resource": ""
} |
q12962 | ViewManager.createInclusionPath | train | private function createInclusionPath($name, $module = null)
{
if (is_null($module)) {
$module = $this->module;
}
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $module, $this->theme);
| php | {
"resource": ""
} |
q12963 | ViewManager.moduleAsset | train | public function moduleAsset($asset, $module = null, $absolute = false) | php | {
"resource": ""
} |
q12964 | ViewManager.asset | train | public function asset($asset, $module = null, $absolute = false)
{
| php | {
"resource": ""
} |
q12965 | ViewManager.createContentWithLayout | train | private function createContentWithLayout($layout, $fragment)
{
// Create and append $fragment variable to the shared view stack
| php | {
"resource": ""
} |
q12966 | ViewManager.render | train | public function render($template, array $vars = array())
{
// Make sure template file isn't empty string
if (empty($template)) {
throw new LogicException('Empty template name provided');
}
if (!$this->templateExists($template)) {
$base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
}
// Template file
$file = $this->createInclusionPath($template);
$this->addVariables($vars);
if ($this->hasLayout()) {
$layout | php | {
"resource": ""
} |
q12967 | ViewManager.renderRaw | train | public function renderRaw($module, $theme, $template, array $vars = array())
{
// Save initial values before overriding theme
$initialLayout = $this->layout;
$initialModule = $this->module;
$initialTheme = $this->theme;
| php | {
"resource": ""
} |
q12968 | ViewManager.loadPartial | train | public function loadPartial($name, array $vars = array())
{
$partialTemplateFile = $this->getPartialBag()->getPartialFile($name);
if (is_file($partialTemplateFile)) {
| php | {
"resource": ""
} |
q12969 | HtmlHelper.wrapOnDemand | train | public static function wrapOnDemand($condition, $tag, $content)
{
if ($condition) { | php | {
"resource": ""
} |
q12970 | Request.baseContext | train | public function baseContext() {
$baseContext = get_property("web.base_context", "");
if (empty($baseContext)) { | php | {
"resource": ""
} |
q12971 | Request.setData | train | public function setData(array $request = []) {
unset($this->parameters);
| php | {
"resource": ""
} |
q12972 | LayoutProcessor.beforeProcess | train | public function beforeProcess(
\Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
$jsLayout
) {
if (!$this->enhancementHelper->isActiveGoogleAddress()) {
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']
| php | {
"resource": ""
} |
q12973 | ValidatorBuilderTrait.hasMandatoryItem | train | protected function hasMandatoryItem(array $definition)
{
foreach ($definition as $key => $node) {
if (isset($node['required'])) {
if ($node['required']) {
return true;
}
} else {
| php | {
"resource": ""
} |
q12974 | MapManager.getDataByUriTemplate | train | public function getDataByUriTemplate($uriTemplate, $option = null)
{
if (isset($this->map[$uriTemplate])) {
$target = $this->map[$uriTemplate];
if ($option !== null) {
// The option might not be set, so ensure
if (!isset($target[$option])) {
throw new RuntimeException(sprintf('Can not read non-existing option %s for "%s"', $option, $uriTemplate));
} else {
return $target[$option];
| php | {
"resource": ""
} |
q12975 | MapManager.getControllers | train | public function getControllers()
{
$map = $this->map;
$result = array();
foreach ($map as $template => $options) | php | {
"resource": ""
} |
q12976 | MapManager.findUriTemplatesByController | train | public function findUriTemplatesByController($controller)
{
$result = array();
foreach ($this->map as $uriTemplate => $options) {
if (isset($options['controller']) && $options['controller'] | php | {
"resource": ""
} |
q12977 | MapManager.getUrlTemplateByController | train | public function getUrlTemplateByController($controller)
{
$result = $this->findUriTemplatesByController($controller);
// Now check the results of search
| php | {
"resource": ""
} |
q12978 | MapManager.getControllerByURITemplate | train | public function getControllerByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
$controller = substr($controller, 0, $separatorPosition);
| php | {
"resource": ""
} |
q12979 | MapManager.getActionByURITemplate | train | public function getActionByURITemplate($uriTemplate)
{
$controller = $this->getDataByUriTemplate($uriTemplate, 'controller');
$separatorPosition = strpos($controller, '@');
if ($separatorPosition !== false) {
| php | {
"resource": ""
} |
q12980 | Socket.open | train | public function open($host, $port, $timeout)
{
if (($this->socket = @fsockopen($host, | php | {
"resource": ""
} |
q12981 | Socket.isTimedOut | train | public function isTimedOut()
{
if (is_resource($this->socket)) {
$info = stream_get_meta_data($this->socket);
}
| php | {
"resource": ""
} |
q12982 | Socket.readLine | train | public function readLine()
{
do {
$line = rtrim(fgets($this->socket));
// server must have dropped the connection
if ($line === '' && feof($this->socket)) {
| php | {
"resource": ""
} |
q12983 | EngineType.getServiceNamesByType | train | public function getServiceNamesByType($type)
{
if (!$this->hasServices()) {
return [];
}
$types = [];
$services = $this->getServices(); | php | {
"resource": ""
} |
q12984 | EngineType.getServiceInstances | train | public function getServiceInstances()
{
$instances = [];
foreach ($this->getServices() as $name => $info) {
if (!isset($info['type'])) {
continue;
}
$type = $info['type'];
unset($info['type']);
$instances[$name] = [
'type' => $type,
| php | {
"resource": ""
} |
q12985 | EngineType.getServiceInstanceByGroup | train | public function getServiceInstanceByGroup($group)
{
$services = [];
$services_map = static::services();
foreach ($this->getServiceInstances() as $name => $info) {
if (!isset($info['type']) || !isset($info['instance'])) {
continue;
}
$type = $info['type'];
if (!isset($services_map[$type])) {
| php | {
"resource": ""
} |
q12986 | EngineType.getServiceInstanceByType | train | public function getServiceInstanceByType($type)
{
$services = [];
$instances = $this->getServiceInstances();
foreach ($this->getServiceNamesByType($type) as $name) | php | {
"resource": ""
} |
q12987 | EngineType.getServiceInstanceByInterface | train | public function getServiceInstanceByInterface($interface)
{
foreach ($this->getServiceInstances() as $info) {
if (!isset($info['instance'])) {
continue;
}
| php | {
"resource": ""
} |
q12988 | EngineType.loadService | train | public static function loadService(
EngineTypeInterface $engine,
$type,
$name = null
) {
$classname = static::serviceClassname($type);
if (!class_exists($classname)) {
throw new \RuntimeException(
| php | {
"resource": ""
} |
q12989 | EngineType.serviceClassname | train | public static function serviceClassname($name)
{
$services = static::services();
if (!isset($services[$name])) {
| php | {
"resource": ""
} |
q12990 | EngineType.getOptions | train | protected function getOptions()
{
$engine = $this->getConfigs()->getEngine();
$options = $this->getConfigs()->getOptions();
| php | {
"resource": ""
} |
q12991 | ModelDocument.getFilePathContent | train | public function getFilePathContent() {
if($this->filePathContent === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathContent;
if($this->container){
$path = $this->container->get("kernel")->locateResource($this->filePathContent);
}
| php | {
"resource": ""
} |
q12992 | ModelDocument.getFilePathHeader | train | public function getFilePathHeader() {
if($this->filePathHeader === null){
throw new InvalidArgumentException(sprintf("The filePathContent must be setter."));
}
$path = $this->filePathHeader;
if($this->container){
$path = $this->container->get("kernel")->locateResource($path);
}
| php | {
"resource": ""
} |
q12993 | ModelDocument.getDocumentPath | train | protected function getDocumentPath(array $parameters = []) {
$dirOut = $this->getDirOutput();
$dirOut | php | {
"resource": ""
} |
q12994 | ConstraintException.getTargetNode | train | protected function getTargetNode()
{
if (null === $target = $this->getTarget()) {
$segments = explode('/', $this->getPath());
$target = '';
while (count($segments) > 0) {
$segment = array_pop($segments);
| php | {
"resource": ""
} |
q12995 | ObjectValidator.isValid | train | public function isValid($item)
{
if (!$item) {
$item = new \stdClass();
}
| php | {
"resource": ""
} |
q12996 | Purifier.GetHTMLPurifierConfig | train | private static function GetHTMLPurifierConfig() {
$defaultConfig = \HTMLPurifier_Config::createDefault();
$customConfig = Config::inst()->get('g4b0\HtmlPurifier\Purifier', 'html_purifier_config');
if(is_array($customConfig)) {
| php | {
"resource": ""
} |
q12997 | Purifier.Purify | train | public static function Purify($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', 'span,p,br,a,h1,h2,h3,h4,h5,strong,em,u,ul,li,ol,hr,blockquote,sub,sup,p[class],img');
$config->set('HTML.AllowedElements', array('span', 'p', 'br', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'strong', 'em', 'u', 'ul', 'li', 'ol', 'hr', 'blockquote', 'sub', 'sup', 'img'));
$config->set('HTML.AllowedAttributes', | php | {
"resource": ""
} |
q12998 | Purifier.PurifyXHTML | train | public static function PurifyXHTML($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTML.TidyLevel', 'heavy'); // all changes, minus...
$config->set('CSS.AllowedProperties', array());
$config->set('Attr.AllowedClasses', array());
$config->set('HTML.Allowed', null);
$config->set('AutoFormat.RemoveEmpty', true); // Remove empty tags
$config->set('AutoFormat.Linkify', true); // add <A> to links | php | {
"resource": ""
} |
q12999 | Purifier.PurifyTXT | train | public static function PurifyTXT($html = null, $encoding = 'UTF-8') {
$config = self::GetHTMLPurifierConfig();
$config->set('Core.Encoding', $encoding);
$config->set('HTML.Allowed', null); // Allow Nothing
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.