_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q12500 | MissingCommand.getOldLemmas | train | protected function getOldLemmas($file_lang_path, array $values = [])
{
if (!is_writable(dirname($file_lang_path))) {
$this->error(" > Unable to write file in directory " . dirname($file_lang_path));
die();
}
if (!file_exists($file_lang_path)) {
$this->... | php | {
"resource": ""
} |
q12501 | SqlEngineFactory.build | train | public static function build($pdo, $table)
{
$mapper = new CacheMapper(new NativeSerializer(), $pdo, $table);
return new SqlCacheEngine($mapper);
} | php | {
"resource": ""
} |
q12502 | MemberAddress.canCreate | train | public function canCreate($member = null)
{
if (!$member) {
$member = Member::currentUser();
}
$extended = $this->extendedCan('canCreate', $member);
if ($extended !== null) {
return $extended;
}
if ($member) {
return true;
... | php | {
"resource": ""
} |
q12503 | Connector.login | train | public function login($username, $password)
{
// @ - intentionally, because false is enough
if (@ftp_login($this->stream, $username, $password)) {
$this->loggedIn = true;
return true;
} else {
return false;
}
} | php | {
"resource": ""
} |
q12504 | ImageProcessor.text | train | public function text($text, $fontFile, $size, array $rgb = array(0, 0, 0), $corner = self::IMG_CENTER_CORNER, $offsetX = 0, $offsetY = 0, $angle = 0)
{
$box = imagettfbbox($size, $angle, $fontFile, $text);
// Calculate width and height for the text
$height = $box[1] - $box[7];
$widt... | php | {
"resource": ""
} |
q12505 | ImageProcessor.flip | train | public function flip($type)
{
// Initial positioning
$x = 0;
$y = 0;
// Save original dimensions
$width = $this->width;
$height = $this->height;
switch ($type) {
case self::IMG_FLIP_BOTH:
$x = $this->width - 1;
$y ... | php | {
"resource": ""
} |
q12506 | ImageProcessor.watermark | train | public function watermark($watermarkFile, $corner = self::IMG_RIGHT_BOTTOM_CORNER, $offsetX = 10, $offsetY = 10)
{
// The very first thing we gotta do is to load watermark's image file
$watermark = new ImageFile($watermarkFile);
// Initial positioning
$x = 0;
$y = 0;
... | php | {
"resource": ""
} |
q12507 | ImageProcessor.blackwhite | train | public function blackwhite()
{
imagefilter($this->image, \IMG_FILTER_GRAYSCALE);
imagefilter($this->image, \IMG_FILTER_CONTRAST, -1000);
return $this;
} | php | {
"resource": ""
} |
q12508 | ImageProcessor.resize | train | public function resize($x, $y, $proportional = true)
{
// Check firstly values
if ($x === null || $x > $this->width) {
$x = $this->width;
}
if ($y === null || $y > $this->height) {
$y = $this->height;
}
if ($proportional === true) {
... | php | {
"resource": ""
} |
q12509 | ImageProcessor.crop | train | public function crop($width, $height, $startX = null, $startY = null)
{
if ($width === null) {
$width = $this->width;
}
if ($height === null) {
$height = $this->height;
}
if ($startX === null) {
$startX = floor(($this->width - $width) / 2... | php | {
"resource": ""
} |
q12510 | ImageProcessor.thumb | train | public function thumb($width, $height)
{
$this->resize($width, $height)
->crop($width, $height);
return $this;
} | php | {
"resource": ""
} |
q12511 | ImageProcessor.rotate | train | public function rotate($degrees)
{
// Cast to the int, in case we got a numeric string
$degrees = (int) $degrees;
$this->image = imagerotate($this->image, $degrees, 0);
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
return $this;
} | php | {
"resource": ""
} |
q12512 | ImageProcessor.preserveTransparency | train | private function preserveTransparency($image)
{
$transparencyColor = array(0, 0, 0);
switch ($this->type) {
case \IMAGETYPE_GIF:
$color = imagecolorallocate($image, $transparencyColor[0], $transparencyColor[1], $transparencyColor[2]);
imagecolortranspare... | php | {
"resource": ""
} |
q12513 | EventManager.attach | train | public function attach($event, Closure $listener)
{
if (!is_callable($listener)) {
throw new InvalidArgumentException(sprintf(
'Second argument must be callable not "%s"', gettype($listener)
));
}
if (!is_string($event)) {
throw new Invali... | php | {
"resource": ""
} |
q12514 | EventManager.attachMany | train | public function attachMany(array $collection)
{
foreach ($collection as $event => $listener) {
$this->attach($event, $listener);
}
return $this;
} | php | {
"resource": ""
} |
q12515 | EventManager.detach | train | public function detach($event)
{
if ($this->has($event)) {
unset($this->listeners[$event]);
} else {
throw new RuntimeException(sprintf(
'Cannot detach non-existing event "%s"', $event
));
}
} | php | {
"resource": ""
} |
q12516 | EventManager.hasMany | train | public function hasMany(array $events)
{
foreach ($events as $event) {
if (!$this->has($event)) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q12517 | EnvTasks.envUp | train | public function envUp($opts = [
'native' => false,
'no-hostname' => false,
'no-browser' => false
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
/** @var EngineType $engine */
$engine = $this->engineInstance();
if ($engine instanceof DockerEngineT... | php | {
"resource": ""
} |
q12518 | EnvTasks.envRebuild | train | public function envRebuild()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->rebuild();
$this->projectInstance()->rebuildSettings();
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12519 | EnvTasks.envDown | train | public function envDown($opts = [
'include-network' => false,
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->down($opts['include-network']);
// Allow projects to react to the engine shutdown.
$this->invokeEngineEvent('onEngineDown');
... | php | {
"resource": ""
} |
q12520 | EnvTasks.envResume | train | public function envResume()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->start();
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12521 | EnvTasks.envRestart | train | public function envRestart()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->restart();
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12522 | EnvTasks.envReboot | train | public function envReboot($opts = [
'include-network' => false,
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->reboot($opts['include-network']);
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12523 | EnvTasks.envHalt | train | public function envHalt()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->suspend();
$this->executeCommandHook(__FUNCTION__, 'after');
} | php | {
"resource": ""
} |
q12524 | EnvTasks.envInstall | train | public function envInstall()
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->install();
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12525 | EnvTasks.envSsh | train | public function envSsh($opts = ['service' => null])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->ssh($opts['service']);
$this->executeCommandHook(__FUNCTION__, 'after');
return $this;
} | php | {
"resource": ""
} |
q12526 | EnvTasks.envLogs | train | public function envLogs($opts = ['show' => 'all', 'follow' => false, 'service' => null])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->logs($opts['show'], $opts['follow'], $opts['service']);
$this->executeCommandHook(__FUNCTION__, 'after');
return $th... | php | {
"resource": ""
} |
q12527 | EnvTasks.envExec | train | public function envExec(array $execute_command, $opts = ['service' => null])
{
$this->executeCommandHook(__FUNCTION__, 'before');
$this->engineInstance()->exec(
implode(' ', $execute_command),
$opts['service']
);
$this->executeCommandHook(__FUNCTION__, 'after'... | php | {
"resource": ""
} |
q12528 | EnvTasks.addHostName | train | protected function addHostName($no_browser)
{
$host = ProjectX::getProjectConfig()
->getHost();
if (!empty($host)) {
$hostsfile = (new HostsFile())
->setLine('127.0.0.1', $host['name']);
(new HostsFileWriter($hostsfile))->add();
$thi... | php | {
"resource": ""
} |
q12529 | EnvTasks.removeHostName | train | protected function removeHostName()
{
$host = ProjectX::getProjectConfig()
->getHost();
if (!empty($host)) {
$hostsfile = (new HostsFile())
->setLine('127.0.0.1', $host['name']);
(new HostsFileWriter($hostsfile))->remove();
$this->sa... | php | {
"resource": ""
} |
q12530 | EnvTasks.invokeEngineEvent | train | protected function invokeEngineEvent($method)
{
$project = $this->getProjectInstance();
if ($project instanceof EngineEventInterface) {
call_user_func_array([$project, $method], []);
}
$platform = $this->getPlatformInstance();
if ($platform instanceof EngineEvent... | php | {
"resource": ""
} |
q12531 | ModelDocument.setFile | train | public function setFile(UploadedFile $file = null)
{
$this->file = $file;
$this->name = $file->getClientOriginalName();
// check if we have an old image path
if (isset($this->path)) {
// store the old name to delete after the update
$this->temp = $this->path;
... | php | {
"resource": ""
} |
q12532 | ModuleManager.exists | train | public static function exists($string)
{
$instance = self::getInstance();
foreach ($instance->getModules() as $module) {
if ($module->title === $string) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q12533 | ModuleManager.existsController | train | public static function existsController($key)
{
$instance = self::getInstance();
foreach ($instance->getModules() as $module) {
foreach ($module->getControllers() as $controller => $file) {
if ($key == $controller) {
return true;
}
... | php | {
"resource": ""
} |
q12534 | ModuleManager.run | train | public function run($url = null, $method = null)
{
$request = new Request($method, $url);
try {
// foreach ($this->modules as $module) {
//
// }
Profiler::start('router');
if ($match = $this->router->match($url, $method)) {
if ($match['n... | php | {
"resource": ""
} |
q12535 | ModuleManager.getRoutes | train | public function getRoutes()
{
if ($this->config['app']['debug']) {
$html = '<pre>';
$result = array();
foreach ($this->modules as $module) {
$list = $module->getControllersUrlRoutes();
$result = array_merge($list, $result);
}
... | php | {
"resource": ""
} |
q12536 | ModuleManager.handleFilesystem | train | public function handleFilesystem($args, $request)
{
$file = urldecode($args['name']);
$filesystem = new Filesystem($file);
if ($filesystem->exists()) {
if ($filesystem->isPublic()) {
header('Content-Type: ' . mime_content_type($filesystem->getAbsolutePath()));
... | php | {
"resource": ""
} |
q12537 | ExtraAdminController.trashAction | train | public function trashAction()
{
if (false === $this->admin->isGranted('LIST')) {
throw new AccessDeniedException();
}
$em = $this->getDoctrine()->getManager();
$em->getFilters()->disable('softdeleteable');
$em->getFilters()->enable('softdeleteabletrash');
... | php | {
"resource": ""
} |
q12538 | Paginator.formatToArrayStandard | train | function formatToArrayStandard($route = null,array $parameters = array()) {
$links = array(
'self' => array('href' => ''),
'first' => array('href' => ''),
'last' => array('href' => ''),
'next' => array('href' => ''),
'previous' => array('href' => '... | php | {
"resource": ""
} |
q12539 | Paginator.formatToArrayDataTables | train | function formatToArrayDataTables($route = null,array $parameters = array()) {
$results = $this->getCurrentPageResults()->getArrayCopy();
$data = array(
'draw' => $this->draw,
'recordsTotal' => $this->getNbResults(),
'recordsFiltered' => $this->getNbResults(),
... | php | {
"resource": ""
} |
q12540 | Paginator.toArray | train | function toArray($route = null,array $parameters = array(),$format = null) {
if($format === null){
$format = $this->defaultFormat;
}
if(in_array($format, $this->formatArray)){
$method = 'formatToArray'.ucfirst($format);
return $this->$method($route,$parameters... | php | {
"resource": ""
} |
q12541 | Paginator.generateUrl | train | protected function generateUrl($route,array $parameters){
return $this->container->get('router')->generate($route, $parameters, Router::ABSOLUTE_URL);
} | php | {
"resource": ""
} |
q12542 | Paginator.getLinks | train | protected function getLinks($route,array $parameters = array()){
$links = array();
if($route != null){
$baseParams = $_GET;
unset($baseParams["page"]);
$parameters = array_merge($parameters,$baseParams);
$links['first']['href'] = $this->generateUrl($route,... | php | {
"resource": ""
} |
q12543 | Paginator.setRequest | train | function setRequest(\Symfony\Component\HttpFoundation\Request $request) {
$this->request = $request;
if(self::FORMAT_ARRAY_DATA_TABLES == $this->defaultFormat){
//Ejemplo start(20) / length(10) = 2
$start = (int)$request->get("start",0);//Elemento inicio
$len... | php | {
"resource": ""
} |
q12544 | Filesystem.allocate | train | public static function allocate($filename = null, $extension = ".rnd", $folder = null)
{
if ($filename === null) {
$filename = sha1(time() . "_" . microtime(true));
}
if ($folder) {
$ffolder = new Filesystem($folder);
if (!$ffolder->exists()) {
... | php | {
"resource": ""
} |
q12545 | Filesystem.getFilesystemFolder | train | public function getFilesystemFolder()
{
$config = Bootstrap::getSingleton()->getConfig();
if (isset($config['app']['filesystem'])) {
return Bootstrap::getSingleton()->getDirectory() . '/' . $config['app']['filesystem'];
}
return Bootstrap::getSingleton()->getDirecto... | php | {
"resource": ""
} |
q12546 | Filesystem.url | train | public function url($expires = null)
{
$this->setPublic($expires);
return get_protocol() . $_SERVER['HTTP_HOST'] . '/_raw/' . $this->file;
} | php | {
"resource": ""
} |
q12547 | PimpleDumper._writePHPStorm | train | protected function _writePHPStorm($map, $className)
{
$fileName = $this->_root . DIRECTORY_SEPARATOR . self::FILE_PHPSTORM;
if (is_dir($fileName)) {
$fileName .= DIRECTORY_SEPARATOR . 'pimple.meta.php';
}
$list = array();
foreach ($map as $data) {
if... | php | {
"resource": ""
} |
q12548 | PimpleDumper._updateFile | train | protected function _updateFile($fileName, $content)
{
$oldContent = null;
if (file_exists($fileName)) {
$oldContent = file_get_contents($fileName);
}
if ($content !== $oldContent) {
file_put_contents($fileName, $content);
}
return $fileName;
... | php | {
"resource": ""
} |
q12549 | ForwardableHandler.forwardMessage | train | public function forwardMessage($toChatId, bool $disableNotification = false): void
{
$m = $this->bot->forwardMessage();
$m->setChatId($toChatId);
$m->setFromChatId($this->message->getChat()->getId());
$m->setMessageId($this->message->getMessageId());
$m->setDisableNotification($disableNotification);
$m->s... | php | {
"resource": ""
} |
q12550 | JsonStorage.load | train | public function load()
{
// Initial state, is always empty array
$data = array();
// Alter $data in case it exists and its valid
if ($this->storageAdapter->has($this->key)) {
$target = $this->serializer->unserialize($this->storageAdapter->get($this->key));
/... | php | {
"resource": ""
} |
q12551 | JsonStorage.save | train | public function save(array $data)
{
// This is what we're going to store
$seriaziledData = $this->serializer->serialize($data);
$this->storageAdapter->set($this->key, $seriaziledData, $this->ttl);
return true;
} | php | {
"resource": ""
} |
q12552 | JsonStorage.clear | train | public function clear()
{
if ($this->storageAdapter->has($this->key)) {
$this->storageAdapter->remove($this->key);
}
} | php | {
"resource": ""
} |
q12553 | FtpFactory.build | train | public static function build($host, $username = null, $password = null, $timeout = 90, $port = 21, $ssl = false)
{
$connector = new Connector($host, $timeout, $port, $ssl);
if (!$connector->connect()) {
throw new RuntimeException('Cannot connect to remote FTP server');
}
... | php | {
"resource": ""
} |
q12554 | TableType.isColumn | train | protected function isColumn(ResolvedBlockTypeInterface $type)
{
if ('table_column' === $type->getBlockPrefix()) {
return true;
}
if (null !== $type->getParent()) {
return $this->isColumn($type->getParent());
}
return false;
} | php | {
"resource": ""
} |
q12555 | SecurityHandler.checkSecurity | train | public function checkSecurity($rol,$parameters = null) {
if($rol === null){
throw $this->createAccessDeniedHttpException($this->trans($this->genericMessage));
}
$roles = $rol;
if(!is_array($rol)){
$roles = array($rol);
}
$valid = $this->getSecurity... | php | {
"resource": ""
} |
q12556 | SecurityHandler.buildMessage | train | private function buildMessage($rol,$prefix = '403')
{
return $this->trans(sprintf('%s.%s.%s', $this->prefixMessage,$prefix,strtolower($rol)));
} | php | {
"resource": ""
} |
q12557 | SecurityHandler.setFlash | train | protected function setFlash($type,$message,$parameters = array(),$domain = 'flashes')
{
return $this->container->get('session')->getBag('flashes')->add($type,$message);
} | php | {
"resource": ""
} |
q12558 | AbstractImageManagerFactory.build | train | final public function build()
{
return new ImageManager($this->getPath(), $this->getRootDir(), $this->getRootUrl(), $this->getConfig());
} | php | {
"resource": ""
} |
q12559 | DiggStyle.getPageNumbers | train | public function getPageNumbers(array $pages, $current)
{
$result = array();
$amount = count($pages);
$start = 3;
if ($amount > $start) {
// this specifies the range of pages we want to show in the middle
$min = max($current - 2, 2);
$max = min($c... | php | {
"resource": ""
} |
q12560 | ControllerFactory.build | train | public function build($controller, $action, array $options)
{
$class = Ns::normalize($controller);
// PSR-0 Autoloader will do its own job by default when calling class_exists() function
if (class_exists($class)) {
// Target module which is going to be instantiated
... | php | {
"resource": ""
} |
q12561 | RoutesManager.getRoutesFromIndex | train | private function getRoutesFromIndex (&$routes, &$routesIndex, &$requestMethod, &$requestPathParts, $requestPathIndex = 0) {
if (!empty($requestPathParts[$requestPathIndex])) {
$requestPathPart = $requestPathParts[$requestPathIndex];
if (array_key_exists($requestPathPart, $routesIndex)) {... | php | {
"resource": ""
} |
q12562 | RoutesManager.getRoutesFromIndexActions | train | private function getRoutesFromIndexActions (&$routes, array &$routeActions, &$requestMethod, array &$requestPathParts) {
foreach ($routeActions as $routeData) {
$routePath = $routeData[0];
$routeAction = $routeData[1];
$routeParameters = [];
if (strpos($routePath,... | php | {
"resource": ""
} |
q12563 | DynamicDoctrineChoiceLoader.getRealValues | train | protected function getRealValues(array $values, $value = null)
{
$value = $this->getCallableValue($value);
foreach ($values as &$val) {
if (\is_object($val) && \is_callable($value)) {
$val = \call_user_func($value, $val);
}
}
return $values;
... | php | {
"resource": ""
} |
q12564 | GoogleTasks.listTasklists | train | public function listTasklists(
array $queryParameters = []
): array {
$parameters = [
'maxResults' => 100,
];
$parameters = array_merge($parameters, $queryParameters);
return $this
->taskService
->tasklists
->listTasklists($pa... | php | {
"resource": ""
} |
q12565 | GoogleTasks.listTasks | train | public function listTasks(
string $taskListId,
Carbon $dueMin = null,
array $queryParameters = []
): array {
$parameters = [
'showCompleted' => false,
'showDeleted' => true,
'showHidden' => true,
];
if (is_null($dueMin)) {
... | php | {
"resource": ""
} |
q12566 | GoogleTasks.getTask | train | public function getTask(string $taskId): Google_Service_Tasks
{
return $this->service->tasks->get($this->tasklist, $taskId);
} | php | {
"resource": ""
} |
q12567 | GoogleTasks.insertTask | train | public function insertTask($task): Google_Service_Tasks
{
if ($task instanceof Tasks) {
$task = $task->googleTasks;
}
return $this->service->tasks->insert($this->tasklist, $task);
} | php | {
"resource": ""
} |
q12568 | GoogleTasks.deleteTask | train | public function deleteTask($taskId)
{
if ($taskId instanceof Tasks) {
$taskId = $taskId->id;
}
$this->service->tasks->delete($this->tasklist, $taskId);
} | php | {
"resource": ""
} |
q12569 | Input.getFiles | train | public function getFiles($name = null)
{
if ($name !== null) {
if (!array_key_exists($name, $this->files)) {
throw new RuntimeException(sprintf(
'Attempted to access non-existing field %s', $name
));
}
return $this->hyd... | php | {
"resource": ""
} |
q12570 | Input.hydrateAll | train | private function hydrateAll(array $files)
{
foreach ($files as $name => $file) {
// Recursive protection
if (!is_array($file)) {
continue;
}
foreach ($file as $key => $value) {
if (is_array($value)) {
// Rec... | php | {
"resource": ""
} |
q12571 | Input.hydrate | train | private function hydrate(array $file)
{
$entity = new FileEntity();
$entity->setType($file['type'])
->setName($file['name'])
->setTmpName($file['tmp_name'])
->setSize($file['size'])
->setError($file['error']);
return $entity;
} | php | {
"resource": ""
} |
q12572 | Input.removeBrokenFiles | train | private function removeBrokenFiles(array $files)
{
// Recursive logic to replace broken arrays with empty ones (which to be removed later)
if (isset($files['error'])) {
return $files['error'] == 4 ? array() : $files;
}
foreach ($files as $key => $value) {
// ... | php | {
"resource": ""
} |
q12573 | Routes.handleRequestNotFound | train | private static function handleRequestNotFound () {
$response = get_response();
$response->clear();
$response->statusCode(Response::HTTP_NOT_FOUND);
$notFoundRoutes = self::$notFoundRoutes->getRoutes();
if (!empty($notFoundRoutes)) {
foreach ($notFoundRoutes as $notFou... | php | {
"resource": ""
} |
q12574 | KernelFactory.build | train | public static function build(array $config)
{
$input = new Input();
$input->setQuery($_GET)
->setPost($_POST)
->setCookie($_COOKIE)
->setFiles($_FILES)
->setServer($_SERVER)
->setEnv($_ENV)
->setRequest($_REQUEST);
retu... | php | {
"resource": ""
} |
q12575 | ThumbFactory.build | train | public function build($dir, $quality, array $options = array())
{
// Alter default quality on demand
if (isset($options['quality'])) {
$quality = $options['quality'];
}
return new Thumb($dir, $options['dimensions'], $quality);
} | php | {
"resource": ""
} |
q12576 | SqlConfigService.store | train | public function store($module, $name, $value)
{
$this->initializeOnDemand();
if (!$this->has($module, $name)) {
if ($this->configMapper->insert($module, $name, $value)) {
$this->arrayConfig->add($module, $name, $value);
return true;
}
... | php | {
"resource": ""
} |
q12577 | SqlConfigService.storeModule | train | public function storeModule($module, array $vars)
{
foreach ($vars as $key => $value) {
if (!$this->store($module, $key, $value)) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q12578 | SqlConfigService.get | train | public function get($module, $name, $default = false)
{
$this->initializeOnDemand();
return $this->arrayConfig->get($module, $name, $default);
} | php | {
"resource": ""
} |
q12579 | SqlConfigService.has | train | public function has($module, $name)
{
$this->initializeOnDemand();
return $this->arrayConfig->has($module, $name);
} | php | {
"resource": ""
} |
q12580 | SqlConfigService.removeAll | train | public function removeAll()
{
$this->initializeOnDemand();
if ($this->configMapper->truncate()) {
$this->arrayConfig->clear();
return true;
} else {
return false;
}
} | php | {
"resource": ""
} |
q12581 | SqlConfigService.remove | train | public function remove($module, $name)
{
$this->initializeOnDemand();
if ($this->exists($module, $name) && $this->configMapper->delete($module, $name)) {
$this->arrayConfig->remove($module, $name);
return true;
} else {
return false;
}
} | php | {
"resource": ""
} |
q12582 | SqlConfigService.removeAllByModule | train | public function removeAllByModule($module)
{
$this->initializeOnDemand();
if ($this->arrayConfig->hasModule($module) && $this->configMapper->deleteAllByModule($module)) {
$this->arrayConfig->removeAllByModule($module);
return true;
} else {
return false;
... | php | {
"resource": ""
} |
q12583 | GitAuthorExtractor.isDirtyFile | train | private function isDirtyFile($path, $git)
{
if (!\is_file($path)) {
return false;
}
$status = (array) $git->status()->short()->getIndexStatus();
$relPath = (string) \substr($path, (\strlen($git->getRepositoryPath()) + 1));
if (isset($status[$relPath]) && $statu... | php | {
"resource": ""
} |
q12584 | GitAuthorExtractor.getAuthorListFrom | train | private function getAuthorListFrom()
{
$filePath = $this->getFilePathCollection($this->currentPath);
$authors = [];
foreach ((array) $filePath['commits'] as $commit) {
if ($this->isMergeCommit($commit)
|| isset($authors[\md5($commit['name'])])
) {
... | php | {
"resource": ""
} |
q12585 | GitAuthorExtractor.collectFilesWithCommits | train | public function collectFilesWithCommits(GitRepository $git)
{
// git show --format="%H" --quiet
$lastCommitId = $git->show()->format('%H')->execute('--quiet');
$cacheId = \md5(__FUNCTION__ . $lastCommitId);
if ($this->cachePool->has($cacheId)) {
$fromCache = $this->... | php | {
"resource": ""
} |
q12586 | GitAuthorExtractor.prepareCommitCollection | train | private function prepareCommitCollection(
GitRepository $git,
array $logList,
array &$commitCollection,
array &$filePathMapping,
array &$filePathCollection
) {
foreach ($logList as $log) {
$currentCacheId = \md5(__FUNCTION__ . $log['commit']);
... | php | {
"resource": ""
} |
q12587 | GitAuthorExtractor.prepareChangeCollection | train | private function prepareChangeCollection(
array $commit,
array $changeCollection,
array &$commitCollection,
array &$filePathMapping,
array &$filePathCollection
) {
foreach ($changeCollection as $change) {
if (!isset($commit['containedPath'])) {
... | php | {
"resource": ""
} |
q12588 | GitAuthorExtractor.getFilePathCollection | train | private function getFilePathCollection($path)
{
$key = \array_flip($this->filePathMapping)[$path];
return $this->filePathCollection[$key];
} | php | {
"resource": ""
} |
q12589 | GitAuthorExtractor.setFilePathCollection | train | private function setFilePathCollection($path, array $data)
{
$key = \array_flip($this->filePathMapping)[$path];
$this->filePathCollection[$key] = $data;
} | php | {
"resource": ""
} |
q12590 | GitAuthorExtractor.countMergeCommits | train | private function countMergeCommits(array $commitList)
{
$count = 0;
foreach ($commitList as $filePathCommit) {
if (!$this->isMergeCommit($filePathCommit)) {
continue;
}
$count++;
}
return $count;
} | php | {
"resource": ""
} |
q12591 | GitAuthorExtractor.buildFileHistory | train | private function buildFileHistory(GitRepository $git)
{
$filePath = $this->getFilePathCollection($this->currentPath);
// If the commit history only merges,
// then use the last merge commit for find the renaming file for follow the history.
if (\count((array) $filePath['commits']) =... | php | {
"resource": ""
} |
q12592 | GitAuthorExtractor.getFileContent | train | private function getFileContent($search, GitRepository $git)
{
$cacheId = \md5(__FUNCTION__ . $search);
if (!$this->cachePool->has($cacheId)) {
$fileContent = $git->show()->execute($search);
$this->cachePool->set($cacheId, $fileContent);
return $fileContent;
... | php | {
"resource": ""
} |
q12593 | GitAuthorExtractor.fetchNameStatusFromCommit | train | private function fetchNameStatusFromCommit($commitId, GitRepository $git)
{
$arguments = [
$git->getConfig()->getGitExecutablePath(),
'show',
$commitId,
'-M',
'--name-status',
'--format='
];
// git show $commitId -M --n... | php | {
"resource": ""
} |
q12594 | GitAuthorExtractor.fetchCurrentCommit | train | private function fetchCurrentCommit(GitRepository $git)
{
return \json_decode(
\sprintf(
'[%s]',
// git show --format=$this->logFormat() --quiet
$git->show()->format($this->logFormat())->execute('--quiet')
),
true
);... | php | {
"resource": ""
} |
q12595 | GitAuthorExtractor.fetchAllCommits | train | private function fetchAllCommits(GitRepository $git)
{
$currentCommit = $this->fetchCurrentCommit($git);
$cacheId = \md5(__FUNCTION__ . \serialize($currentCommit));
if (!$this->cachePool->has($cacheId)) {
$logList = \json_decode(
\sprintf(
'[... | php | {
"resource": ""
} |
q12596 | GitAuthorExtractor.fetchFileHistory | train | private function fetchFileHistory($path, GitRepository $git)
{
$fileHistory = [];
foreach ($this->fetchCommitCollectionByPath($path, $git) as $logItem) {
// If the renaming/copy to not found in the file history, then continue the loop.
if (\count($fileHistory) && !\in_array($... | php | {
"resource": ""
} |
q12597 | GitAuthorExtractor.fetchCommitCollectionByPath | train | private function fetchCommitCollectionByPath($path, GitRepository $git)
{
// git log --follow --name-status --format='%H' -- $path
$log = $git->log()->follow()->revisionRange('--name-status')->revisionRange('--format=%H')->execute($path);
\preg_match_all(
"/^(?'commit'.*)\n+(?'c... | php | {
"resource": ""
} |
q12598 | GitAuthorExtractor.executeFollowDetection | train | private function executeFollowDetection(array $logItem, array &$fileHistory, GitRepository $git)
{
$currentCommit = $this->commitCollection[$logItem['commit']];
if (($logItem['index'] <= 70) && \in_array($logItem['criteria'], ['R', 'C'])) {
if (isset($currentCommit['information'][\md5($... | php | {
"resource": ""
} |
q12599 | GitAuthorExtractor.renamingDetection | train | private function renamingDetection(array $logItem, array $currentCommit, array &$fileHistory, GitRepository $git)
{
if ($logItem['criteria'] !== 'R') {
return;
}
if ((int) $logItem['index'] >= 75) {
$fileHistory[\md5($logItem['from'])] = $logItem['from'];
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.