_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6100 | SMTP.Close | train | public function Close()
{
$this->error = null; // so there is no confusion
$this->helo_rply = null;
if (!empty($this->smtp_conn)) {
| php | {
"resource": ""
} |
q6101 | AbstractProcessor.registerAnnotations | train | static protected function registerAnnotations()
{
if (self::$annotationsRegistered === false) {
AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/ResourceIdentifier.php');
AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/Relationship.php');
| php | {
"resource": ""
} |
q6102 | AbstractProcessor.createLink | train | protected function createLink(LinkAnnotation $annotation): Link
{
if (! preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) {
throw new \LogicException(sprintf('Invalid resource definition: "%s"', $annotation->resource));
| php | {
"resource": ""
} |
q6103 | Validator.isValidLocalClass | train | public function isValidLocalClass()
{
$className = SPLASH_CLASS_PREFIX.'\\Local';
//====================================================================//
// Verify Results in Cache
if (isset($this->ValidLocalClass[$className])) {
return $this->ValidLocalClass[$className];
}
$this->ValidLocalClass[$className] = false;
//====================================================================//
// Verify Splash Local Core Class Exists
if (false == class_exists($className)) {
return Splash::log()->err(Splash::trans('ErrLocalClass', $className));
}
//====================================================================//
// Verify Splash Local Core Extends LocalClassInterface
try {
| php | {
"resource": ""
} |
q6104 | Validator.isValidLocalParameterArray | train | public function isValidLocalParameterArray($input)
{
//====================================================================//
// Verify Array Given
if (!is_array($input)) {
return Splash::log()->err(Splash::trans('ErrorCfgNotAnArray', get_class($input)));
}
//====================================================================//
| php | {
"resource": ""
} |
q6105 | Validator.isValidServerInfos | train | public function isValidServerInfos()
{
$infos = Splash::ws()->getServerInfos();
//====================================================================//
// Verify Array Given
if (!is_a($infos, 'ArrayObject')) {
return Splash::log()->err(Splash::trans('ErrInfosNotArrayObject', get_class($infos)));
}
if (defined('SPLASH_DEBUG') && !empty(SPLASH_DEBUG)) {
Splash::log()->war('Host : '.$infos['ServerHost']);
Splash::log()->war('Path : '.$infos['ServerPath']);
}
//====================================================================//
// Required Parameters are Available
//====================================================================//
if (!isset($infos['ServerHost']) || empty($infos['ServerHost'])) {
Splash::log()->err(Splash::trans('ErrEmptyServerHost'));
return Splash::log()->err(Splash::trans('ErrEmptyServerHostDesc'));
}
| php | {
"resource": ""
} |
q6106 | Validator.isLocalInstallation | train | public function isLocalInstallation($infos)
{
if (false !== strpos($infos['ServerHost'], 'localhost')) {
Splash::log()->war(Splash::trans('WarIsLocalhostServer'));
| php | {
"resource": ""
} |
q6107 | Validator.isValidObject | train | public function isValidObject($objectType)
{
//====================================================================//
// Verify Result in Cache
if (isset($this->ValidLocalObject[$objectType])) {
return $this->ValidLocalObject[$objectType];
}
$this->ValidLocalObject[$objectType] = false;
//====================================================================//
// Verify Local Core Class Exist & Is Valid
if (!$this->isValidLocalClass()) {
return false;
}
//====================================================================//
// Check if Object Manager is NOT Overriden
if (!(Splash::local() instanceof ObjectsProviderInterface)) {
//====================================================================//
| php | {
"resource": ""
} |
q6108 | Validator.isValidObjectId | train | public function isValidObjectId($objectId)
{
//====================================================================//
// Checks Id is not Null
if (is_null($objectId)) {
return Splash::log()->err('ErrEmptyObjectId');
}
//====================================================================//
// Checks Id is String or Int
if (!is_string($objectId) && !is_numeric($objectId)) {
| php | {
"resource": ""
} |
q6109 | Validator.isValidObjectFieldsList | train | public function isValidObjectFieldsList($fieldsList)
{
//====================================================================//
// Checks List Type
if (!is_array($fieldsList) && !($fieldsList instanceof ArrayObject)) {
return Splash::log()->err('ErrWrongFieldList');
}
//====================================================================//
| php | {
"resource": ""
} |
q6110 | Validator.isValidWidget | train | public function isValidWidget($widgetType)
{
//====================================================================//
// Verify Result in Cache
if (isset($this->ValidLocalWidget[$widgetType])) {
return $this->ValidLocalWidget[$widgetType];
}
$this->ValidLocalWidget[$widgetType] = false;
//====================================================================//
// Verify Local Core Class Exist & Is Valid
if (!$this->isValidLocalClass()) {
return false;
}
//====================================================================//
// Check if Widget Manager is NOT Overriden
if (!(Splash::local() instanceof WidgetsProviderInterface)) {
//====================================================================//
| php | {
"resource": ""
} |
q6111 | Validator.isValidLocalPath | train | public function isValidLocalPath()
{
//====================================================================//
// Verify no result in Cache
if (!isset($this->ValidLocalPath)) {
$path = Splash::getLocalPath();
//====================================================================//
// Verify Local Path Exist
if (is_null($path) || !is_dir($path)) {
| php | {
"resource": ""
} |
q6112 | Validator.isValidPHPVersion | train | public function isValidPHPVersion()
{
if (version_compare(PHP_VERSION, '5.6.0') < 0) {
return Splash::log()->err(
'PHP : Your PHP version is too low to use Splash ('.PHP_VERSION.'). PHP >5.6 is Requiered.'
);
}
| php | {
"resource": ""
} |
q6113 | Validator.isValidPHPExtensions | train | public function isValidPHPExtensions()
{
$extensions = array('xml', 'soap', 'curl');
foreach ($extensions as $extension) {
if (!extension_loaded($extension)) {
return Splash::log()->err( | php | {
"resource": ""
} |
q6114 | Validator.isValidSOAPMethod | train | public function isValidSOAPMethod()
{
if (!in_array(Splash::configuration()->WsMethod, array('SOAP', 'NuSOAP'), true)) {
return Splash::log()->err(
'Config : Your selected an unknown SOAP Method ('.Splash::configuration()->WsMethod.').'
);
| php | {
"resource": ""
} |
q6115 | Validator.isValidConfigurator | train | public function isValidConfigurator($className)
{
//====================================================================//
// Verify Class Exists
if (false == class_exists($className)) {
return Splash::log()->err('Configurator Class Not Found: '.$className);
}
//====================================================================//
// Verify Configurator Class Extends ConfiguratorInterface
try {
$class = new $className();
if (!($class instanceof ConfiguratorInterface)) {
| php | {
"resource": ""
} |
q6116 | Validator.isValidObjectFile | train | private function isValidObjectFile($objectType)
{
//====================================================================//
// Verify Local Path Exist
if (false == $this->isValidLocalPath()) {
return false;
}
//====================================================================//
| php | {
"resource": ""
} |
q6117 | Validator.isValidObjectClass | train | private function isValidObjectClass($objectType)
{
//====================================================================//
// Check if Object Manager is Overriden
if (Splash::local() instanceof ObjectsProviderInterface) {
//====================================================================//
// Retrieve Object Manager ClassName
$className = get_class(Splash::local()->object($objectType));
} else {
$className = SPLASH_CLASS_PREFIX.'\\Objects\\'.$objectType;
}
//====================================================================//
// Verify Splash Local Core Class Exists
if (false == class_exists($className)) {
return Splash::log()->err(Splash::trans('ErrLocalClass', $objectType));
}
//====================================================================//
// Verify Local Object Core Class Functions Exists
| php | {
"resource": ""
} |
q6118 | Validator.isValidWidgetFile | train | private function isValidWidgetFile($widgetType)
{
//====================================================================//
// Verify Local Path Exist
if (false == $this->isValidLocalPath()) {
return false;
}
//====================================================================//
| php | {
"resource": ""
} |
q6119 | Validator.isValidWidgetClass | train | private function isValidWidgetClass($widgetType)
{
//====================================================================//
// Check if Widget Manager is Overriden
if (Splash::local() instanceof WidgetsProviderInterface) {
//====================================================================//
// Retrieve Widget Manager ClassName
$className = get_class(Splash::local()->widget($widgetType));
} else {
$className = SPLASH_CLASS_PREFIX.'\\Widgets\\'.$widgetType;
}
//====================================================================//
// Verify Splash Local Core Class Exists
if (false == class_exists($className)) {
return Splash::log()->err(Splash::trans('ErrLocalClass', $widgetType));
}
//====================================================================//
// Verify Local Widget Core Class Functions Exists
//====================================================================// | php | {
"resource": ""
} |
q6120 | CallbackFactory.instantiateCallback | train | protected function instantiateCallback($callbackClass, $callbackType)
{
if (!is_a($callbackClass, static::$callbackInterface, true))
{
throw new RuntimeException("Callback class '{$callbackClass}' does not implements '" .
| php | {
"resource": ""
} |
q6121 | PostgreSQL.getTableGeomType | train | public function getTableGeomType($tableName, $schema = null)
{
$connection = $this->connection;
if (strpos($tableName, '.')) {
list($schema, $tableName) = explode('.', $tableName);
}
$_schema = $schema ? $connection->quote($schema) : 'current_schema()';
$type = $connection->query("SELECT \"type\"
| php | {
"resource": ""
} |
q6122 | PostgreSQL.getLastInsertId | train | public function getLastInsertId()
{
$connection = $this->getConnection();
$id = $connection->lastInsertId();
if ($id < 1) {
$fullTableName = $this->tableName;
$fullUniqueIdName = $connection->quoteIdentifier($this->getUniqueId());
| php | {
"resource": ""
} |
q6123 | PostgreSQL.getNodeFromGeom | train | public function getNodeFromGeom($waysVerticesTableName, $waysGeomFieldName, $ewkt, $transformTo = null, $idKey = "id")
{
$db = $this->getConnection();
$geom = "ST_GeometryFromText('" . $db->quote($ewkt) . "')";
if ($transformTo) {
$geom = "ST_TRANSFORM($geom, $transformTo)";
| php | {
"resource": ""
} |
q6124 | PostgreSQL.routeBetweenNodes | train | public function routeBetweenNodes(
$waysTableName,
$waysGeomFieldName,
$startNodeId,
$endNodeId,
$srid,
$directedGraph = false,
$hasReverseCost = false)
{
/** @var Connection $db */
$db = $this->getConnection();
$waysTableName = $db->quoteIdentifier($waysTableName);
$geomFieldName = $db->quoteIdentifier($waysGeomFieldName);
$directedGraph = $directedGraph ? 'TRUE' : 'FALSE'; // directed graph [true|false]
$hasReverseCost = $hasReverseCost && $directedGraph ? 'TRUE' : 'FALSE'; // directed graph [true|false]
$results = $db->query("SELECT
route.seq as orderId,
route.id1 as startNodeId,
route.id2 as endNodeId,
route.cost as distance,
ST_AsEWKT ($waysTableName.$geomFieldName) AS geom
FROM
| php | {
"resource": ""
} |
q6125 | Insurer.all | train | public function all(string $country = 'MY', ?Query $query = null): Response
{
| php | {
"resource": ""
} |
q6126 | FeatureType.getById | train | public function getById($id, $srid = null)
{
$rows = $this->getSelectQueryBuilder($srid)
->where($this->getUniqueId() . " = :id")
->setParameter('id', $id)
->execute()
| php | {
"resource": ""
} |
q6127 | FeatureType.search | train | public function search(array $criteria = array())
{
/** @var Statement $statement */
/** @var Feature $feature */
$maxResults = isset($criteria['maxResults']) ? intval($criteria['maxResults']) : self::MAX_RESULTS;
$intersect = isset($criteria['intersectGeometry']) ? $criteria['intersectGeometry'] : null;
$returnType = isset($criteria['returnType']) ? $criteria['returnType'] : null;
$srid = isset($criteria['srid']) ? $criteria['srid'] : $this->getSrid();
$where = isset($criteria['where']) ? $criteria['where'] : null;
$queryBuilder = $this->getSelectQueryBuilder($srid);
$connection = $queryBuilder->getConnection();
$whereConditions = array();
// add GEOM where condition
if ($intersect) {
$geometry = BaseDriver::roundGeometry($intersect, 2);
$whereConditions[] = $this->getDriver()->getIntersectCondition($geometry, $this->geomField, $srid, $this->getSrid());
}
| php | {
"resource": ""
} |
q6128 | FeatureType.getTableSequenceName | train | public function getTableSequenceName()
{
$connection = $this->getConnection();
$result = $connection->fetchColumn("SELECT column_default from information_schema.columns where table_name='" . $this->getTableName() . "' and | php | {
"resource": ""
} |
q6129 | FeatureType.getFileUri | train | public function getFileUri($fieldName = null)
{
$path = self::UPLOAD_DIR_NAME . "/" . $this->getTableName();
if ($fieldName) {
$path .= "/" . $fieldName;
}
foreach ($this->getFileInfo() as $fileInfo) {
if (isset($fileInfo["field"]) && isset($fileInfo["uri"]) && | php | {
"resource": ""
} |
q6130 | FeatureType.getFilePath | train | public function getFilePath($fieldName = null, $createPath = true)
{
$path = realpath(AppComponent::getUploadsDir($this->container)) . "/" . $this->getFileUri($fieldName);
foreach ($this->getFileInfo() as $fileInfo) {
if (isset($fileInfo["field"]) && isset($fileInfo["path"]) && $fieldName == $fileInfo["field"]) {
| php | {
"resource": ""
} |
q6131 | FeatureType.genFilePath | train | public function genFilePath($fieldName = null)
{
$id = $this->countFiles($fieldName) + 1;
$src = null;
$path = null;
while (1) {
$path = $id; //. "-" . System::generatePassword(12) ;
$src = $this->getFilePath($fieldName) . "/" . $path;
if | php | {
"resource": ""
} |
q6132 | FeatureType.countFiles | train | private function countFiles($fieldName = null)
{
$finder = new Finder();
| php | {
"resource": ""
} |
q6133 | FeatureType.routeBetweenGeom | train | public function routeBetweenGeom($sourceGeom, $targetGeom)
{
$driver = $this->getDriver();
$srid = $this->getSrid();
$sourceNode = $driver->getNodeFromGeom($this->waysVerticesTableName, $this->waysGeomFieldName, | php | {
"resource": ""
} |
q6134 | FeatureType.getByIds | train | public function getByIds($ids, $prepareResults = true)
{
$queryBuilder = $this->getSelectQueryBuilder();
$connection = $queryBuilder->getConnection();
$rows = $queryBuilder->where(
$queryBuilder->expr()->in($this->getUniqueId(), array_map(function ($id) use ($connection) {
return $connection->quote($id); | php | {
"resource": ""
} |
q6135 | FeatureType.getConfiguration | train | public function getConfiguration($key = null)
{
return isset($this->_args[ | php | {
"resource": ""
} |
q6136 | FeatureType.export | train | public function export(array &$rows)
{
$config = $this->getConfiguration('export');
$fieldNames = isset($config['fields']) ? $config['fields'] : null;
$result = array();
if ($fieldNames) {
foreach ($rows as &$row) { | php | {
"resource": ""
} |
q6137 | ConsoleExporterTrait.getConsoleLog | train | public function getConsoleLog($clean = false)
{
$result = null;
//====================================================================//
// Read All Messages as Html
$result .= $this->getConsole($this->err, ' - Error => ', self::CMD_COLOR_ERR);
$result .= $this->getConsole($this->war, ' - Warning => ', self::CMD_COLOR_WAR);
$result .= $this->getConsole($this->msg, ' - Messages => ', self::CMD_COLOR_MSG);
$result .= $this->getConsole($this->deb, ' | php | {
"resource": ""
} |
q6138 | ConsoleExporterTrait.getConsole | train | private function getConsole($msgArray, $title = '', $color = 0)
{
$result = '';
if ((is_array($msgArray) || $msgArray instanceof Countable) && count($msgArray)) {
//====================================================================//
// Add Messages
| php | {
"resource": ""
} |
q6139 | AttributeHandler.processAttributeToResource | train | protected function processAttributeToResource($object, ResourceObject $resource, Attribute $definition)
{
$name = $definition->getName();
$getter = $definition->getGetter();
$value = $object->$getter();
if ($value === null && ! $definition->getProcessNull()) {
| php | {
"resource": ""
} |
q6140 | AttributeHandler.processResourceToAttribute | train | protected function processResourceToAttribute($object, ResourceObject $resource, Attribute $definition)
{
$name = $definition->getName();
if (! $resource->hasAttribute($name)) {
return;
}
$value = $resource->getAttribute($name);
if ($value === null && ! | php | {
"resource": ""
} |
q6141 | Html._parse_form_attributes | train | private static function _parse_form_attributes($attributes, $default)
{
if (is_array($attributes)) {
foreach ($default as $key => $val) {
if (isset($attributes[$key])) {
$default[$key] = $attributes[$key];
unset($attributes[$key]);
}
}
if (count($attributes) > 0) {
$default = array_merge($default, $attributes);
| php | {
"resource": ""
} |
q6142 | DateIntervalHandler.resolveFormat | train | protected function resolveFormat(\DateInterval $interval): string
{
$baseFormat = $this->resolveBaseFormat($interval);
$timeFormat = $this->resolveTimeFormat($interval);
if ($baseFormat === '') {
if ($timeFormat === '') {
return '';
}
return 'PT' . $timeFormat;
| php | {
"resource": ""
} |
q6143 | DateIntervalHandler.resolveBaseFormat | train | protected function resolveBaseFormat(\DateInterval $interval): string
{
$format = '';
if ($interval->y > 0) {
$format .= '%yY';
}
if ($interval->m > 0) {
| php | {
"resource": ""
} |
q6144 | DateIntervalHandler.resolveTimeFormat | train | protected function resolveTimeFormat(\DateInterval $interval): string
{
$format = '';
if ($interval->h > 0) {
$format .= '%hH';
}
if ($interval->i > 0) {
| php | {
"resource": ""
} |
q6145 | App.getInstance | train | public static function getInstance(ServerRequestInterface $request)
{
if (is_null(self::$instance)) {
$class = get_called_class();
| php | {
"resource": ""
} |
q6146 | App.run | train | public function run()
{
$request = clone $this->request;
$response = new Response(404, new Stream(null));
$this->container->callHook('app.response.before', [ &$request, &$response ]);
if (($route = $this->router->parse($request)) && $response->getStatusCode() == 404) {
$this->container->callHook($route[ 'key' ] . '.response.before', [
&$request,
&$response
]);
$exec = $this->router->execute($route, $request);
$response = $this->parseResponse($exec);
| php | {
"resource": ""
} |
q6147 | App.loadRoutesAndServices | train | protected function loadRoutesAndServices()
{
foreach ($this->modules as $module) {
if ($module->getPathRoutes()) {
$routesConfig = Util::getJson($module->getPathRoutes());
| php | {
"resource": ""
} |
q6148 | YamlDefinitionProvider.readConfig | train | protected function readConfig(string $path): array
{
if (! is_readable($path)) {
throw new DefinitionProviderException(sprintf('File "%s" with definition is not readable.', $path));
}
$content = file_get_contents($path);
$config = | php | {
"resource": ""
} |
q6149 | YamlDefinitionProvider.getSchema | train | protected function getSchema(): NodeInterface
{
if ($this->schema === null) { | php | {
"resource": ""
} |
q6150 | Drivers.create | train | public function create(int $fleetId, string $fullname, string $identification, array $optional = []): Response
{
$this->requiresAccessToken();
return $this->sendJson(
'POST',
| php | {
"resource": ""
} |
q6151 | AnnotationDefinitionProvider.createDefinition | train | protected function createDefinition(\ReflectionClass $reflection): Definition
{
$definition = new Definition($reflection->getName());
foreach ($this->processors as $processor)
{
$processor->process($reflection, $definition);
}
$parent = $reflection->getParentClass();
if ($parent !== false) { | php | {
"resource": ""
} |
q6152 | LinkHandler.createLink | train | protected function createLink(LinkDefinition $definition, LinkData $data): LinkObject
{
$reference = $data->getReference();
$metadata = array_replace(
$data->getMetadata(),
| php | {
"resource": ""
} |
q6153 | Application.run | train | function run()
{
// Set default error level, In dev env show all errors
// ini_set('display_errors', Config::get('show_errors') ? 'Off' : 'Off');
ini_set('display_errors', 'Off');
error_reporting(E_ALL | E_STRICT);
if (!defined('SERVER_MODE')) {
// Mark server mode
define('SERVER_MODE', 'fpm');
}
try {
$route = (\ePHP\Core\Route::init())->findRoute();
// dumpdie($route);
if (empty($route)) {
\show_404();
}
// 整理参数
$_GET['controller'] = $route[0];
$_GET['action'] = $route[1];
$controller_name = $route[2];
$action_name = $_GET['action'];
$_REQUEST = array_merge($_COOKIE, $_GET, $_POST);
// 检查ACTION是否存在 | php | {
"resource": ""
} |
q6154 | Profile.update | train | public function update(array $payload): Response
{
$this->requiresAccessToken();
return $this->sendJson(
| php | {
"resource": ""
} |
q6155 | Profile.verifyPassword | train | public function verifyPassword(string $password): bool
{
$this->requiresAccessToken();
try {
$response = $this->send(
'POST',
'auth/verify',
$this->getApiHeaders(),
| php | {
"resource": ""
} |
q6156 | Profile.uploadAvatar | train | public function uploadAvatar(string $file): Response
{
$this->requiresAccessToken();
return $this->stream(
| php | {
"resource": ""
} |
q6157 | ContactServiceProvider.registerContactMailer | train | protected function registerContactMailer()
{
$this->app->bind('contact.mailer', function ($app) {
$mail = $app['mailer'];
$home = $app['url']->to('/');
$path = $app['config']['contact.path'];
$email = $app['config']['contact.email'];
$name = | php | {
"resource": ""
} |
q6158 | ContactServiceProvider.registerContactController | train | protected function registerContactController()
{
$this->app->bind(ContactController::class, function ($app) {
$throttler = $app['throttle']->get($app['request'], 2, 30);
| php | {
"resource": ""
} |
q6159 | IntelParserTrait.verifyRequiredFields | train | public function verifyRequiredFields()
{
foreach ($this->Fields() as $field) {
//====================================================================//
// Field is NOT required
if (!$field["required"]) {
continue;
}
//====================================================================//
// Field is Required but not available
if (!$this->verifyRequiredFieldIsAvailable($field["id"])) {
| php | {
"resource": ""
} |
q6160 | IntelParserTrait.setObjectData | train | private function setObjectData()
{
//====================================================================//
// Walk on All Requested Fields
//====================================================================//
$fields = is_a($this->in, "ArrayObject") ? $this->in->getArrayCopy() : $this->in;
foreach ($fields as $fieldName => $fieldData) {
//====================================================================//
// Write Requested Fields
foreach ($this->identifySetMethods() as $method) {
$this->{$method}($fieldName, $fieldData);
}
} | php | {
"resource": ""
} |
q6161 | IntelParserTrait.identifyMethods | train | private static function identifyMethods($prefix)
{
//====================================================================//
// Prepare List of Available Methods
$result = array();
| php | {
"resource": ""
} |
q6162 | IntelParserTrait.verifyRequiredFieldIsAvailable | train | private function verifyRequiredFieldIsAvailable($fieldId)
{
//====================================================================//
// Detect List Field Names
if (!method_exists($this, "Lists") || !self::lists()->listName($fieldId)) {
//====================================================================//
// Simple Field is Required but not available
if (empty($this->in[$fieldId])) {
return false;
}
return true;
}
//====================================================================//
// List Field is required
$listName = self::lists()->ListName($fieldId);
$fieldName = self::lists()->FieldName($fieldId);
//====================================================================//
// Check List is available
if (empty($this->in[$listName])) {
| php | {
"resource": ""
} |
q6163 | AbstractConfigurator.getConfigurationValue | train | private function getConfigurationValue($key1, $key2 = null)
{
//====================================================================//
// Load Configuration from Configurator
$config = $this->getConfiguration();
//====================================================================//
// Check Configuration is Valid
if (!is_array($config) || empty($config)) {
return null;
}
//====================================================================//
// Check Main Configuration Key Exists
if (!isset($config[$key1])) {
return null;
}
| php | {
"resource": ""
} |
q6164 | AbstractConfigurator.sercureParameters | train | private static function sercureParameters(&$parameters)
{
//====================================================================//
// Detect Travis from SERVER CONSTANTS => Allow Unsecure for Testing
if (!empty(Splash::input('SPLASH_TRAVIS'))) {
return;
}
//====================================================================//
// Walk on Unsecure Parameter Keys
| php | {
"resource": ""
} |
q6165 | AbstractConfigurator.updateField | train | private static function updateField($field, $values)
{
Splash::log()->trace();
//====================================================================//
// Check New Configuration is an Array
if (!is_array($values)) {
return $field;
}
//====================================================================//
// Field Type
self::updateFieldStrVal($field, $values, "type");
// Field Name
self::updateFieldStrVal($field, $values, "name");
// Field Description
self::updateFieldStrVal($field, $values, "desc");
// Field Group
self::updateFieldStrVal($field, $values, "group");
// Field MetaData
self::updateFieldMeta($field, $values);
//====================================================================//
// Field Favorite Sync Mode
self::updateFieldStrVal($field, $values, "syncmode");
//====================================================================//
// Field is Required Flag
self::updateFieldBoolVal($field, $values, "required");
| php | {
"resource": ""
} |
q6166 | AbstractConfigurator.updateFieldStrVal | train | private static function updateFieldStrVal(&$field, $values, $key)
{
| php | {
"resource": ""
} |
q6167 | AbstractConfigurator.updateFieldBoolVal | train | private static function updateFieldBoolVal(&$field, $values, $key)
{
if (isset($values[$key]) && is_scalar($values[$key])) {
| php | {
"resource": ""
} |
q6168 | AbstractConfigurator.updateFieldMeta | train | private static function updateFieldMeta(&$field, $values)
{
// Update Field Meta ItemType
self::updateFieldStrVal($field, $values, "itemtype");
// Update Field Meta ItemProp
self::updateFieldStrVal($field, $values, "itemprop");
// Update Field Meta Tag
if (isset($values["itemprop"]) || isset($values["itemtype"])) {
| php | {
"resource": ""
} |
q6169 | FeatureTypeService.get | train | public function get($id)
{
if (empty($this->instances[$id])) {
$declarations = $this->getFeatureTypeDeclarations();
if (empty($declarations[$id])) {
throw new \RuntimeException("No FeatureType with id " . var_export($id, true));
| php | {
"resource": ""
} |
q6170 | FeatureTypeService.search | train | public function search()
{
foreach ($this->getFeatureTypeDeclarations() as $id => $declaration) {
if (empty($this->instances[$id])) {
| php | {
"resource": ""
} |
q6171 | Typo3.createMessage | train | public function createMessage( $charset = 'UTF-8' )
{
$closure = $this->closure;
| php | {
"resource": ""
} |
q6172 | Typo3.send | train | public function send( \Aimeos\MW\Mail\Message\Iface $message )
{ | php | {
"resource": ""
} |
q6173 | Attribute.merge | train | public function merge(self $attribute)
{
if ($this->propertyName === null && $attribute->hasPropertyName()) {
$this->propertyName = $attribute->getPropertyName();
}
if ($this->type === null && $attribute->hasType()) {
$this->type = $attribute->getType();
}
if ($this->many === null && $attribute->hasManyDefined()) {
$this->many = $attribute->isMany();
}
if (empty($this->typeParameters)) {
| php | {
"resource": ""
} |
q6174 | Command.execute | train | public function execute(array $args, array $options = array())
{
if (!count($args)) {
throw new ConsoleException("Missing subcommand name");
}
$command = ucfirst(Utils::camelize(array_shift($args)));
$methodName = "execute$command";
if (!method_exists($this, $methodName)) {
throw | php | {
"resource": ""
} |
q6175 | Command.writeerr | train | public function writeerr($text)
{
return | php | {
"resource": ""
} |
q6176 | Query.includes | train | protected function includes($includes)
{
$includes = \is_array($includes) ? $includes : \func_get_args();
| php | {
"resource": ""
} |
q6177 | Query.onTimeZone | train | protected function onTimeZone(?string $timeZoneCode)
{
if (\is_null($timeZoneCode)) {
$this->timezone = null;
| php | {
"resource": ""
} |
q6178 | Query.excludes | train | protected function excludes($excludes)
{
$excludes = \is_array($excludes) ? $excludes : \func_get_args();
| php | {
"resource": ""
} |
q6179 | Query.build | train | public function build(callable $callback): array
{
$data = [];
foreach (['includes', 'excludes'] as $key) {
if (! empty($this->{$key})) {
$data[$key] = \implode(',', $this->{$key});
}
}
if (! \is_null($this->timezone)) {
| php | {
"resource": ""
} |
q6180 | Request.getApiHeaders | train | protected function getApiHeaders(): array
{
$headers = [
'Accept' => "application/vnd.KATSANA.{$this->getVersion()}+json",
'Time-Zone' => $this->requestHeaderTimezoneCode ?? 'UTC',
];
| php | {
"resource": ""
} |
q6181 | Request.onTimeZone | train | final public function onTimeZone(string $timeZoneCode): self
{
if (\in_array($timeZoneCode, \timezone_identifiers_list())) {
| php | {
"resource": ""
} |
q6182 | Logger.setDebug | train | public function setDebug($debug)
{
//====================================================================//
// Change Parameter State
$this->debug = $debug;
//====================================================================//
| php | {
"resource": ""
} |
q6183 | Logger.err | train | public function err($text = null, $param1 = '', $param2 = '', $param3 = '', $param4 = '')
{
//====================================================================//
// Safety Check
if (is_null($text)) {
return false;
}
//====================================================================//
// Translate Message
$message = Splash::trans($text, (string) $param1, (string) $param2, (string) $param3, (string) $param4);
| php | {
"resource": ""
} |
q6184 | Logger.war | train | public function war($text = null, $param1 = '', $param2 = '', $param3 = '', $param4 = '')
{
//====================================================================//
// Safety Check
if (is_null($text)) {
return true;
}
//====================================================================//
// Translate Message
$message = Splash::trans($text, (string) $param1, (string) $param2, (string) $param3, (string) $param4);
| php | {
"resource": ""
} |
q6185 | Logger.trace | train | public function trace()
{
//====================================================================//
// Safety Check
if (!isset($this->debug) || !$this->debug) {
return;
}
//====================================================================//
// Build Error Trace
$trace = (new Exception())->getTrace()[1];
//====================================================================//
| php | {
"resource": ""
} |
q6186 | Logger.cleanLog | train | public function cleanLog()
{
if (isset($this->err)) {
$this->err = array();
}
if (isset($this->war)) {
$this->war = array();
}
if (isset($this->msg)) {
$this->msg = array();
| php | {
"resource": ""
} |
q6187 | Logger.getRawLog | train | public function getRawLog($clean = false)
{
$raw = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
if ($this->err) {
$raw->err = $this->err;
}
if ($this->war) {
| php | {
"resource": ""
} |
q6188 | Logger.merge | train | public function merge($logs)
{
if (!empty($logs->msg)) {
$this->mergeCore('msg', $logs->msg);
$this->addLogBlockToFile($logs->msg, 'MESSAGE');
}
if (!empty($logs->err)) {
$this->mergeCore('err', $logs->err);
$this->addLogBlockToFile($logs->err, 'ERROR');
}
if (!empty($logs->war)) {
| php | {
"resource": ""
} |
q6189 | Logger.flushOuputBuffer | train | public function flushOuputBuffer()
{
//====================================================================//
// Read the contents of the output buffer
$contents = ob_get_contents();
//====================================================================//
// Clean (erase) the output buffer and turn off | php | {
"resource": ""
} |
q6190 | Logger.coreAddLog | train | private function coreAddLog($type, $message)
{
//====================================================================//
// Safety Check
if (is_null($message)) {
return;
}
//====================================================================//
// Initialise buffer if unset | php | {
"resource": ""
} |
q6191 | Logger.mergeCore | train | private function mergeCore($logType, $logArray)
{
//====================================================================//
// Fast Line
if (empty($logArray)) {
return;
}
//====================================================================//
// Detect ArrayObjects
if ($logArray instanceof ArrayObject) {
$logArray = $logArray->getArrayCopy();
}
//====================================================================//
// If Current Log is Empty
if (!isset($this->{$logType})) {
$this->{$logType} | php | {
"resource": ""
} |
q6192 | NifValidator.isValid | train | public static function isValid(string $nif): bool
{
return self::isValidDni($nif) | php | {
"resource": ""
} |
q6193 | NifValidator.isValidPersonal | train | public static function isValidPersonal(string $nif): bool
{
return self::isValidDni($nif) | php | {
"resource": ""
} |
q6194 | NifValidator.isValidDni | train | public static function isValidDni(string $dni): bool
{
if (!preg_match(self::DNI_REGEX, $dni, $matches)) {
return false;
}
if ('00000000' === $matches['number']) {
return | php | {
"resource": ""
} |
q6195 | NifValidator.isValidNie | train | public static function isValidNie(string $nie): bool
{
if (!preg_match(self::NIE_REGEX, $nie, $matches)) {
return false;
| php | {
"resource": ""
} |
q6196 | NifValidator.isValidOtherPersonalNif | train | public static function isValidOtherPersonalNif(string $nif): bool
{
if (!preg_match(self::OTHER_PERSONAL_NIF_REGEX, $nif, | php | {
"resource": ""
} |
q6197 | NifValidator.isValidCif | train | public static function isValidCif(string $cif): bool
{
if (!preg_match(self::CIF_REGEX, $cif, $matches)) {
return false;
| php | {
"resource": ""
} |
q6198 | DB_mysqlco.prepareDB | train | private function prepareDB()
{
$dbpool = DBPool::init($this->db_config);
// var_dump($dbpool->cap + $dbpool->activeCount, $dbpool->queue->isEmpty(), $dbpool->queue->count());
if ($dbpool->queue->isEmpty() && ($dbpool->cap + $dbpool->activeCount >= $this->config['max_pool_size'])) {
\throw_error('MySQL pool is empty...', 12009);
}
| php | {
"resource": ""
} |
q6199 | Httpclient.get | train | public function get($url, $params = array(), $options = array())
{
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.