repository_name
stringlengths 5
67
| func_path_in_repository
stringlengths 4
234
| func_name
stringlengths 0
314
| whole_func_string
stringlengths 52
3.87M
| language
stringclasses 6
values | func_code_string
stringlengths 52
3.87M
| func_documentation_string
stringlengths 1
47.2k
| func_code_url
stringlengths 85
339
|
---|---|---|---|---|---|---|---|
Boolive/Core | file/File.php | File.getDirSize | static function getDirSize($dir)
{
$size = 0;
$dirs = array_diff(scandir($dir), array('.', '..'));
foreach ($dirs as $d){
$d = $dir.'/'.$d;
$size+= filesize($d);
if (is_dir($d)){
$size+= self::getDirSize($d);
}
}
return $size;
} | php | static function getDirSize($dir)
{
$size = 0;
$dirs = array_diff(scandir($dir), array('.', '..'));
foreach ($dirs as $d){
$d = $dir.'/'.$d;
$size+= filesize($d);
if (is_dir($d)){
$size+= self::getDirSize($d);
}
}
return $size;
} | Размер директории в байтах
@param string $dir Путь на директорию
@return int | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/file/File.php#L359-L371 |
Boolive/Core | file/File.php | File.makeDirName | static function makeDirName($id, $size=3, $depth=3)
{
$size = intval(max(1, $size));
$depth = intval(max(1,$depth));
$id = self::clearFileName($id);
$id = str_repeat('0',max(0, $size*$depth-strlen($id))).$id;
$dir = '';
for ($i=1; $i<$depth; $i++){
$dir = substr($id,-$size*$i, $size).'/'.$dir;
}
return (substr($id,0, -$size*($i-1))).'/'.$dir;
} | php | static function makeDirName($id, $size=3, $depth=3)
{
$size = intval(max(1, $size));
$depth = intval(max(1,$depth));
$id = self::clearFileName($id);
$id = str_repeat('0',max(0, $size*$depth-strlen($id))).$id;
$dir = '';
for ($i=1; $i<$depth; $i++){
$dir = substr($id,-$size*$i, $size).'/'.$dir;
}
return (substr($id,0, -$size*($i-1))).'/'.$dir;
} | Создание пути на директорию из идентификатора
@param string $id Идентификатор, который режится на имена директорий. При недостаточности длины добавляются нули.
@param int $size Длина для имен директорий
@param int $depth Вложенность директорий
@return string | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/file/File.php#L380-L391 |
Boolive/Core | file/File.php | File.makeVirtualDir | static function makeVirtualDir($dir, $mkdir = true)
{
if (self::$IS_WIN && mb_strlen($dir) > 248){
$dir = preg_replace('/\\\\/u','/', $dir);
$vdir = mb_substr($dir, 0, 248);
$vdir = F::splitRight('/', $vdir);
if ($vdir[0]){
$vdir = $vdir[0];
if (!is_dir($vdir)){
if ($mkdir){
mkdir($vdir, 0775, true);
}else{
return $dir;
}
}
$dir = self::VIRT_DISK.':/'.mb_substr($dir, mb_strlen($vdir)+1);
system('subst '.self::VIRT_DISK.': '.$vdir);
}
}
return $dir;
} | php | static function makeVirtualDir($dir, $mkdir = true)
{
if (self::$IS_WIN && mb_strlen($dir) > 248){
$dir = preg_replace('/\\\\/u','/', $dir);
$vdir = mb_substr($dir, 0, 248);
$vdir = F::splitRight('/', $vdir);
if ($vdir[0]){
$vdir = $vdir[0];
if (!is_dir($vdir)){
if ($mkdir){
mkdir($vdir, 0775, true);
}else{
return $dir;
}
}
$dir = self::VIRT_DISK.':/'.mb_substr($dir, mb_strlen($vdir)+1);
system('subst '.self::VIRT_DISK.': '.$vdir);
}
}
return $dir;
} | Создание виртуального диска в Windows, для увеличения лимита на длину пути к файлам
@param $dir
@param bool $mkdir
@return mixed|string | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/file/File.php#L399-L419 |
Boolive/Core | file/File.php | File.deleteVirtualDir | static function deleteVirtualDir($vdir)
{
if (self::$IS_WIN && mb_substr($vdir,0,1) == self::VIRT_DISK){
system('subst '.self::VIRT_DISK.': /d');
}
} | php | static function deleteVirtualDir($vdir)
{
if (self::$IS_WIN && mb_substr($vdir,0,1) == self::VIRT_DISK){
system('subst '.self::VIRT_DISK.': /d');
}
} | Удаление виртуального диска в Windows
@param string $vdir Директория с виртуальным диском | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/file/File.php#L425-L430 |
asbamboo/http | Client.php | Client.setBodyCurlOpt | private function setBodyCurlOpt(RequestInterface $Request) : void
{
/*
* Some HTTP methods cannot have payload:
*
* - GET — cURL will automatically change method to PUT or POST if we set CURLOPT_UPLOAD or
* CURLOPT_POSTFIELDS.
* - HEAD — cURL treats HEAD as GET request with a same restrictions.
* - TRACE — According to RFC7231: a client MUST NOT send a message body in a TRACE request.
*/
if(!in_array($Request->getMethod(), [Constant::METHOD_GET, Constant::METHOD_HEAD, Constant::METHOD_TRACE], true)){
$Body = $Request->getBody();
$body_size = $Body->getSize();
if($body_size !== 0){
if($Body->isSeekable()){
$Body->rewind();
}
// Message has non empty body.
if(null === $body_size || $body_size > 1024 * 1024){
// Avoid full loading large or unknown size body into memory
$this->option[CURLOPT_UPLOAD] = true;
if(null !== $body_size){
$this->option[CURLOPT_INFILESIZE] = $body_size;
}
$this->option[CURLOPT_READFUNCTION] = function($ch, $fd, $length)use($Body){
return $Body->read($length);
};
}else{
// Small body can be loaded into memory
$this->option[CURLOPT_POSTFIELDS] = (string) $Body;
}
}
}
if($Request->getMethod() === Constant::METHOD_HEAD){
// This will set HTTP method to "HEAD".
$this->option[CURLOPT_NOBODY] = true;
}
} | php | private function setBodyCurlOpt(RequestInterface $Request) : void
{
/*
* Some HTTP methods cannot have payload:
*
* - GET — cURL will automatically change method to PUT or POST if we set CURLOPT_UPLOAD or
* CURLOPT_POSTFIELDS.
* - HEAD — cURL treats HEAD as GET request with a same restrictions.
* - TRACE — According to RFC7231: a client MUST NOT send a message body in a TRACE request.
*/
if(!in_array($Request->getMethod(), [Constant::METHOD_GET, Constant::METHOD_HEAD, Constant::METHOD_TRACE], true)){
$Body = $Request->getBody();
$body_size = $Body->getSize();
if($body_size !== 0){
if($Body->isSeekable()){
$Body->rewind();
}
// Message has non empty body.
if(null === $body_size || $body_size > 1024 * 1024){
// Avoid full loading large or unknown size body into memory
$this->option[CURLOPT_UPLOAD] = true;
if(null !== $body_size){
$this->option[CURLOPT_INFILESIZE] = $body_size;
}
$this->option[CURLOPT_READFUNCTION] = function($ch, $fd, $length)use($Body){
return $Body->read($length);
};
}else{
// Small body can be loaded into memory
$this->option[CURLOPT_POSTFIELDS] = (string) $Body;
}
}
}
if($Request->getMethod() === Constant::METHOD_HEAD){
// This will set HTTP method to "HEAD".
$this->option[CURLOPT_NOBODY] = true;
}
} | 设置body相关的curl option
@param RequestInterface $Request | https://github.com/asbamboo/http/blob/721156e29227854b787a1232eaa995ab2ccd4f25/Client.php#L122-L162 |
asbamboo/http | Client.php | Client.getCurloptHttpHeader | private function getCurloptHttpHeader(RequestInterface $Request) : array
{
$options = [];
$headers = $Request->getHeaders();
foreach ($headers as $name => $values) {
$header = strtolower($name);
if ('expect' === $header) {
// curl-client does not support "Expect-Continue", so dropping "expect" headers
continue;
}
foreach ($values as $value) {
$options[] = $name . ': ' . $value;
}
}
/*
* curl-client does not support "Expect-Continue", but cURL adds "Expect" header by default.
* We can not suppress it, but we can set it to empty.
*/
$options[] = 'Expect:';
return $options;
} | php | private function getCurloptHttpHeader(RequestInterface $Request) : array
{
$options = [];
$headers = $Request->getHeaders();
foreach ($headers as $name => $values) {
$header = strtolower($name);
if ('expect' === $header) {
// curl-client does not support "Expect-Continue", so dropping "expect" headers
continue;
}
foreach ($values as $value) {
$options[] = $name . ': ' . $value;
}
}
/*
* curl-client does not support "Expect-Continue", but cURL adds "Expect" header by default.
* We can not suppress it, but we can set it to empty.
*/
$options[] = 'Expect:';
return $options;
} | 返回curl option CURLOPT_HTTPHEADER
@param RequestInterface $Request
@return array | https://github.com/asbamboo/http/blob/721156e29227854b787a1232eaa995ab2ccd4f25/Client.php#L170-L191 |
asbamboo/http | Client.php | Client.getCurloptHttpVersion | private function getCurloptHttpVersion(RequestInterface $Request) : int
{
switch($Request->getProtocolVersion()){
case '1.0':
return CURL_HTTP_VERSION_1_0;
case '1.1':
return CURL_HTTP_VERSION_1_1;
case '2.0':
return CURL_HTTP_VERSION_2_0;
}
return CURL_HTTP_VERSION_NONE;
} | php | private function getCurloptHttpVersion(RequestInterface $Request) : int
{
switch($Request->getProtocolVersion()){
case '1.0':
return CURL_HTTP_VERSION_1_0;
case '1.1':
return CURL_HTTP_VERSION_1_1;
case '2.0':
return CURL_HTTP_VERSION_2_0;
}
return CURL_HTTP_VERSION_NONE;
} | 返回curl option CURLOPT_HTTP_VERSION
@param RequestInterface $Request
@return int | https://github.com/asbamboo/http/blob/721156e29227854b787a1232eaa995ab2ccd4f25/Client.php#L199-L210 |
asbamboo/http | Client.php | Client.getCurloptHeaderFunction | private function getCurloptHeaderFunction() : callable
{
return function($ch, $data){
$str = trim($data);
if('' !== $str){
if(strpos(strtolower($str), 'http/') === 0){
$status_line = $str;
@list($http_version, $http_code, $reason_phrase) = explode(' ', $status_line, 3);
$this->Response = $this->Response->withStatus((int) $http_code, (string) $reason_phrase);
$this->Response = $this->Response->withProtocolVersion((string) $http_version);
}else{
$header_line = $str;
@list($name, $value) = explode(':', $header_line, 2);
$this->Response = $this->Response->withAddedHeader(trim((string) $name), trim((string) $value));
}
}
return strlen($data);
};
} | php | private function getCurloptHeaderFunction() : callable
{
return function($ch, $data){
$str = trim($data);
if('' !== $str){
if(strpos(strtolower($str), 'http/') === 0){
$status_line = $str;
@list($http_version, $http_code, $reason_phrase) = explode(' ', $status_line, 3);
$this->Response = $this->Response->withStatus((int) $http_code, (string) $reason_phrase);
$this->Response = $this->Response->withProtocolVersion((string) $http_version);
}else{
$header_line = $str;
@list($name, $value) = explode(':', $header_line, 2);
$this->Response = $this->Response->withAddedHeader(trim((string) $name), trim((string) $value));
}
}
return strlen($data);
};
} | 返回curl option CURLOPT_HEADERFUNCTION
@return callable | https://github.com/asbamboo/http/blob/721156e29227854b787a1232eaa995ab2ccd4f25/Client.php#L217-L235 |
Vyki/mva-dbm | src/Mva/Dbm/Bridges/NetteTracy/ConnectionPanel.php | ConnectionPanel.getTab | public function getTab()
{
if (headers_sent() && !session_id()) {
return;
}
ob_start();
$count = $this->count;
$queries = $this->queries;
require __DIR__ . '/templates/ConnectionPanel.tab.phtml';
return ob_get_clean();
} | php | public function getTab()
{
if (headers_sent() && !session_id()) {
return;
}
ob_start();
$count = $this->count;
$queries = $this->queries;
require __DIR__ . '/templates/ConnectionPanel.tab.phtml';
return ob_get_clean();
} | Renders tab.
@return string | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Bridges/NetteTracy/ConnectionPanel.php#L63-L74 |
Vyki/mva-dbm | src/Mva/Dbm/Bridges/NetteTracy/ConnectionPanel.php | ConnectionPanel.getPanel | public function getPanel()
{
ob_start();
if (!$this->count) {
return;
}
$count = $this->count;
$queries = $this->queries;
require __DIR__ . '/templates/ConnectionPanel.panel.phtml';
return ob_get_clean();
} | php | public function getPanel()
{
ob_start();
if (!$this->count) {
return;
}
$count = $this->count;
$queries = $this->queries;
require __DIR__ . '/templates/ConnectionPanel.panel.phtml';
return ob_get_clean();
} | Renders panel.
@return string | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Bridges/NetteTracy/ConnectionPanel.php#L80-L92 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.& | public function & SetView (\MvcCore\IView & $view) {
parent::SetView($view);
if (self::$appRoot === NULL) self::$appRoot = $this->request->GetAppRoot();
if (self::$basePath === NULL) self::$basePath = $this->request->GetBasePath();
if (self::$scriptName === NULL) self::$scriptName = ltrim($this->request->GetScriptName(), '/.');
$app = $view->GetController()->GetApplication();
$configClass =$app->GetConfigClass();
self::$loggingAndExceptions = $configClass::IsDevelopment(TRUE);
$mvcCoreCompiledMode = $app->GetCompiled();
self::$ctrlActionKey = $this->request->GetControllerName() . '/' . $this->request->GetActionName();
// file checking is true only for classic development mode, not for single file mode
if (!$mvcCoreCompiledMode) self::$fileChecking = TRUE;
// file rendering is true for classic development state, SFU app mode
if (!$mvcCoreCompiledMode || $mvcCoreCompiledMode == 'SFU') {
self::$fileRendering = TRUE;
}
if (is_null(self::$assetsUrlCompletion)) {
// set URL addresses completion to true by default for:
// - all package modes outside PHP_STRICT_HDD and outside development
if ($mvcCoreCompiledMode && $mvcCoreCompiledMode != 'PHP_STRICT_HDD') {
self::$assetsUrlCompletion = TRUE;
} else {
self::$assetsUrlCompletion = FALSE;
}
}
self::$systemConfigHash = md5(json_encode(self::$globalOptions));
return $this;
} | php | public function & SetView (\MvcCore\IView & $view) {
parent::SetView($view);
if (self::$appRoot === NULL) self::$appRoot = $this->request->GetAppRoot();
if (self::$basePath === NULL) self::$basePath = $this->request->GetBasePath();
if (self::$scriptName === NULL) self::$scriptName = ltrim($this->request->GetScriptName(), '/.');
$app = $view->GetController()->GetApplication();
$configClass =$app->GetConfigClass();
self::$loggingAndExceptions = $configClass::IsDevelopment(TRUE);
$mvcCoreCompiledMode = $app->GetCompiled();
self::$ctrlActionKey = $this->request->GetControllerName() . '/' . $this->request->GetActionName();
// file checking is true only for classic development mode, not for single file mode
if (!$mvcCoreCompiledMode) self::$fileChecking = TRUE;
// file rendering is true for classic development state, SFU app mode
if (!$mvcCoreCompiledMode || $mvcCoreCompiledMode == 'SFU') {
self::$fileRendering = TRUE;
}
if (is_null(self::$assetsUrlCompletion)) {
// set URL addresses completion to true by default for:
// - all package modes outside PHP_STRICT_HDD and outside development
if ($mvcCoreCompiledMode && $mvcCoreCompiledMode != 'PHP_STRICT_HDD') {
self::$assetsUrlCompletion = TRUE;
} else {
self::$assetsUrlCompletion = FALSE;
}
}
self::$systemConfigHash = md5(json_encode(self::$globalOptions));
return $this;
} | Insert a \MvcCore\View in each helper constructing
@param \MvcCore\View|\MvcCore\IView $view
@return \MvcCore\Ext\Views\Helpers\AbstractHelper | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L150-L184 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.SetGlobalOptions | public static function SetGlobalOptions ($options = []) {
self::$globalOptions = array_merge(self::$globalOptions, (array) $options);
if (isset($options['assetsUrl']) && !is_null($options['assetsUrl'])) {
self::$assetsUrlCompletion = (bool) $options['assetsUrl'];
}
} | php | public static function SetGlobalOptions ($options = []) {
self::$globalOptions = array_merge(self::$globalOptions, (array) $options);
if (isset($options['assetsUrl']) && !is_null($options['assetsUrl'])) {
self::$assetsUrlCompletion = (bool) $options['assetsUrl'];
}
} | Set global static options about minifying and joining together
which can bee overwritten by single settings throw calling for
example: append() method as another param.
@see \MvcCore\Ext\Views\Helpers\Assets::$globalOptions
@param array $options whether or not to auto escape output
@return void | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L195-L200 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getFileImprint | protected static function getFileImprint ($fullPath) {
$fileChecking = self::$globalOptions['fileChecking'];
if ($fileChecking == 'filemtime') {
return filemtime($fullPath);
} else {
return (string) call_user_func($fileChecking, $fullPath);
}
} | php | protected static function getFileImprint ($fullPath) {
$fileChecking = self::$globalOptions['fileChecking'];
if ($fileChecking == 'filemtime') {
return filemtime($fullPath);
} else {
return (string) call_user_func($fileChecking, $fullPath);
}
} | Returns file modification imprint by global settings -
by `md5_file()` or by `filemtime()` - always as a string
@param string $fullPath
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L231-L238 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.AssetUrl | public function AssetUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = self::$scriptName . '?controller=controller&action=asset&path=' . $path;
} else {
// for \MvcCore\Application::GetInstance()->GetCompiled(), by default equal to: '' (development), 'PHP_STRICT_HDD'
//$result = self::$basePath . $path;
$result = '__RELATIVE_BASE_PATH__' . $path;
}
return $result;
} | php | public function AssetUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = self::$scriptName . '?controller=controller&action=asset&path=' . $path;
} else {
// for \MvcCore\Application::GetInstance()->GetCompiled(), by default equal to: '' (development), 'PHP_STRICT_HDD'
//$result = self::$basePath . $path;
$result = '__RELATIVE_BASE_PATH__' . $path;
}
return $result;
} | Completes font or image file URL inside CSS/JS file content.
If application compile mode is in development state or packed in strict HDD mode,
there is generated standard URL with \MvcCore\Request::$BasePath (current app location)
plus called $path param. Because those application compile modes presume by default,
that those files are placed beside php code on hard drive.
If application compile mode is in php preserve package, php preserve HDD,
php strict package or in single file URL mode, there is generated URL by \MvcCore
in form: '?controller=controller&action=asset&path=...'.
Feel free to change this css/js file URL completion to any custom way.
There could be typically only: "$result = self::$basePath . $path;",
but if you want to complete URL for assets on hard drive or
to any other CDN place, use \MvcCore\Ext\Views\Helpers\Assets::SetBasePath($cdnBasePath);
@param string $path relative path from application document root with slash in begin
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L268-L279 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.CssJsFileUrl | public function CssJsFileUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = $this->view->AssetUrl($path);
} else {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: '' (development), 'PHP_STRICT_HDD'
$result = self::$basePath . $path;
}
return $result;
} | php | public function CssJsFileUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = $this->view->AssetUrl($path);
} else {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: '' (development), 'PHP_STRICT_HDD'
$result = self::$basePath . $path;
}
return $result;
} | Completes CSS or JS file url.
If application compile mode is in development state or packed in strict HDD mode,
there is generated standard URL with \MvcCore\Request->GetBasePath() (current app location)
plus called $path param. Because those application compile modes presume by default,
that those files are placed beside php code on hard drive.
If application compile mode is in php preserve package, php preserve HDD,
php strict package or in single file URL mode, there is generated URL by \MvcCore
in form: 'index.php?controller=controller&action=asset&path=...'.
Feel free to change this css/js file URL completion to any custom way.
There could be typically only: "$result = self::$basePath . $path;",
but if you want to complete URL for assets on hard drive or
to any other CDN place, use \MvcCore\Ext\Views\Helpers\Assets::SetBasePath($cdnBasePath);
@param string $path relative path from application document root with slash in begin
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L301-L311 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems | protected function filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems ($items) {
$itemsToRenderMinimized = [];
$itemsToRenderSeparately = []; // some configurations is not possible to render together and minimized
// go for every item to complete existing combinations in attributes
foreach ($items as & $item) {
$itemArr = array_merge((array) $item, []);
unset($itemArr['path']);
if (isset($itemArr['render'])) unset($itemArr['render']);
if (isset($itemArr['external'])) unset($itemArr['external']);
$renderArrayKey = md5(json_encode($itemArr));
if ($itemArr['doNotMinify']) {
if (isset($itemsToRenderSeparately[$renderArrayKey])) {
$itemsToRenderSeparately[$renderArrayKey][] = $item;
} else {
$itemsToRenderSeparately[$renderArrayKey] = [$item];
}
} else {
if (isset($itemsToRenderMinimized[$renderArrayKey])) {
$itemsToRenderMinimized[$renderArrayKey][] = $item;
} else {
$itemsToRenderMinimized[$renderArrayKey] = [$item];
}
}
}
return [
$itemsToRenderMinimized,
$itemsToRenderSeparately,
];
} | php | protected function filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems ($items) {
$itemsToRenderMinimized = [];
$itemsToRenderSeparately = []; // some configurations is not possible to render together and minimized
// go for every item to complete existing combinations in attributes
foreach ($items as & $item) {
$itemArr = array_merge((array) $item, []);
unset($itemArr['path']);
if (isset($itemArr['render'])) unset($itemArr['render']);
if (isset($itemArr['external'])) unset($itemArr['external']);
$renderArrayKey = md5(json_encode($itemArr));
if ($itemArr['doNotMinify']) {
if (isset($itemsToRenderSeparately[$renderArrayKey])) {
$itemsToRenderSeparately[$renderArrayKey][] = $item;
} else {
$itemsToRenderSeparately[$renderArrayKey] = [$item];
}
} else {
if (isset($itemsToRenderMinimized[$renderArrayKey])) {
$itemsToRenderMinimized[$renderArrayKey][] = $item;
} else {
$itemsToRenderMinimized[$renderArrayKey] = [$item];
}
}
}
return [
$itemsToRenderMinimized,
$itemsToRenderSeparately,
];
} | Look for every item to render if there is any 'doNotMinify' record to render item separately
@param array $items
@return array[] $itemsToRenderMinimized $itemsToRenderSeparately | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L326-L354 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.addFileModificationImprintToHrefUrl | protected function addFileModificationImprintToHrefUrl ($url, $path) {
$questionMarkPos = strpos($url, '?');
$separator = ($questionMarkPos === FALSE) ? '?' : '&';
$strippedUrl = $questionMarkPos !== FALSE ? substr($url, $questionMarkPos) : $url ;
$srcPath = $this->getAppRoot() . substr($strippedUrl, strlen(self::$basePath));
if (self::$globalOptions['fileChecking'] == 'filemtime') {
$fileMTime = self::getFileImprint($srcPath);
$url .= $separator . '_fmt=' . date(
self::FILE_MODIFICATION_DATE_FORMAT,
(int)$fileMTime
);
} else {
$url .= $separator . '_md5=' . self::getFileImprint($srcPath);
}
return $url;
} | php | protected function addFileModificationImprintToHrefUrl ($url, $path) {
$questionMarkPos = strpos($url, '?');
$separator = ($questionMarkPos === FALSE) ? '?' : '&';
$strippedUrl = $questionMarkPos !== FALSE ? substr($url, $questionMarkPos) : $url ;
$srcPath = $this->getAppRoot() . substr($strippedUrl, strlen(self::$basePath));
if (self::$globalOptions['fileChecking'] == 'filemtime') {
$fileMTime = self::getFileImprint($srcPath);
$url .= $separator . '_fmt=' . date(
self::FILE_MODIFICATION_DATE_FORMAT,
(int)$fileMTime
);
} else {
$url .= $separator . '_md5=' . self::getFileImprint($srcPath);
}
return $url;
} | Add to href URL file modification param by original file
@param string $url
@param string $path
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L362-L377 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getIndentString | protected function getIndentString($indent = 0) {
$indentStr = '';
if (is_numeric($indent)) {
$indInt = intval($indent);
if ($indInt > 0) {
$i = 0;
while ($i < $indInt) {
$indentStr .= "\t";
$i += 1;
}
}
} else if (is_string($indent)) {
$indentStr = $indent;
}
return $indentStr;
} | php | protected function getIndentString($indent = 0) {
$indentStr = '';
if (is_numeric($indent)) {
$indInt = intval($indent);
if ($indInt > 0) {
$i = 0;
while ($i < $indInt) {
$indentStr .= "\t";
$i += 1;
}
}
} else if (is_string($indent)) {
$indentStr = $indent;
}
return $indentStr;
} | Get indent string
@param string|int $indent
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L384-L399 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getTmpDir | protected function getTmpDir() {
if (!self::$tmpDir) {
$tmpDir = $this->getAppRoot() . self::$globalOptions['tmpDir'];
if (!\MvcCore\Application::GetInstance()->GetCompiled()) {
if (!is_dir($tmpDir)) mkdir($tmpDir, 0777, TRUE);
if (!is_writable($tmpDir)) {
try {
@chmod($tmpDir, 0777);
} catch (\Exception $e) {
$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
throw new \Exception('['.$selfClass.'] ' . $e->getMessage());
}
}
}
self::$tmpDir = $tmpDir;
}
return self::$tmpDir;
} | php | protected function getTmpDir() {
if (!self::$tmpDir) {
$tmpDir = $this->getAppRoot() . self::$globalOptions['tmpDir'];
if (!\MvcCore\Application::GetInstance()->GetCompiled()) {
if (!is_dir($tmpDir)) mkdir($tmpDir, 0777, TRUE);
if (!is_writable($tmpDir)) {
try {
@chmod($tmpDir, 0777);
} catch (\Exception $e) {
$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
throw new \Exception('['.$selfClass.'] ' . $e->getMessage());
}
}
}
self::$tmpDir = $tmpDir;
}
return self::$tmpDir;
} | Return and store application document root from controller view request object
@throws \Exception
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L414-L431 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.saveFileContent | protected function saveFileContent ($fullPath = '', & $fileContent = '') {
$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
$toolClass::SingleProcessWrite($fullPath, $fileContent);
@chmod($fullPath, 0766);
} | php | protected function saveFileContent ($fullPath = '', & $fileContent = '') {
$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
$toolClass::SingleProcessWrite($fullPath, $fileContent);
@chmod($fullPath, 0766);
} | Save atomically file content in full path by 1 MB to not overflow any memory limits
@param string $fullPath
@param string $fileContent
@return void | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L439-L443 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.log | protected function log ($msg = '', $logType = 'debug') {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::Log($msg, $logType);
}
} | php | protected function log ($msg = '', $logType = 'debug') {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::Log($msg, $logType);
}
} | Log any render messages with optional log file name
@param string $msg
@param string $logType
@return void | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L451-L455 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.warning | protected function warning ($msg) {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::BarDump('[' . get_class($this) . '] ' . $msg, \MvcCore\IDebug::DEBUG);
}
} | php | protected function warning ($msg) {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::BarDump('[' . get_class($this) . '] ' . $msg, \MvcCore\IDebug::DEBUG);
}
} | Throw exception with given message with actual helper class name before
@param string $msg
@return void | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L474-L478 |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getTmpFileFullPathByPartFilesInfo | protected function getTmpFileFullPathByPartFilesInfo ($filesGroupInfo = [], $minify = FALSE, $extension = '') {
return implode('', [
$this->getTmpDir(),
'/' . ($minify ? 'minified' : 'rendered') . '_' . $extension . '_',
md5(implode(',', $filesGroupInfo) . '_' . $minify),
'.' . $extension
]);
} | php | protected function getTmpFileFullPathByPartFilesInfo ($filesGroupInfo = [], $minify = FALSE, $extension = '') {
return implode('', [
$this->getTmpDir(),
'/' . ($minify ? 'minified' : 'rendered') . '_' . $extension . '_',
md5(implode(',', $filesGroupInfo) . '_' . $minify),
'.' . $extension
]);
} | Complete items group tmp directory file name by group source files info
@param array $filesGroupInfo
@param boolean $minify
@return string | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L497-L504 |
nilportugues/php-todo-finder | src/TodoFinder/Finder/FileParser.php | FileParser.validateFileStructure | private function validateFileStructure(array &$file)
{
if (false === array_key_exists(self::TODO_FINDER, $file)) {
throw new FileParserException(
sprintf(
'Provided YAML file does not compile with the required format. '
.'Expected \'%s\' key to be present but none was found.',
self::TODO_FINDER
)
);
}
$this->assertYamlKey($file[self::TODO_FINDER], self::TOTAL_ALLOWED);
$this->assertYamlKey($file[self::TODO_FINDER], self::EXPRESSIONS);
} | php | private function validateFileStructure(array &$file)
{
if (false === array_key_exists(self::TODO_FINDER, $file)) {
throw new FileParserException(
sprintf(
'Provided YAML file does not compile with the required format. '
.'Expected \'%s\' key to be present but none was found.',
self::TODO_FINDER
)
);
}
$this->assertYamlKey($file[self::TODO_FINDER], self::TOTAL_ALLOWED);
$this->assertYamlKey($file[self::TODO_FINDER], self::EXPRESSIONS);
} | @param array $file
@throws FileParserException | https://github.com/nilportugues/php-todo-finder/blob/eea3e63714633744e6e576bf0ca4b8e1d7c20be5/src/TodoFinder/Finder/FileParser.php#L42-L56 |
nilportugues/php-todo-finder | src/TodoFinder/Finder/FileParser.php | FileParser.assertYamlKey | private function assertYamlKey(array &$file, $key)
{
if (false === array_key_exists($key, $file)) {
throw new FileParserException(
sprintf(
'Provided YAML file does not compile with the required format. '
.'Expected \'%s\' key under \'%s\' to be present but none was found.',
$key,
self::TODO_FINDER
)
);
}
} | php | private function assertYamlKey(array &$file, $key)
{
if (false === array_key_exists($key, $file)) {
throw new FileParserException(
sprintf(
'Provided YAML file does not compile with the required format. '
.'Expected \'%s\' key under \'%s\' to be present but none was found.',
$key,
self::TODO_FINDER
)
);
}
} | @param array $file
@param string $key
@throws FileParserException | https://github.com/nilportugues/php-todo-finder/blob/eea3e63714633744e6e576bf0ca4b8e1d7c20be5/src/TodoFinder/Finder/FileParser.php#L64-L76 |
schpill/thin | src/Multithread.php | Multithread.run | public function run($jobs)
{
$lenTab = count($jobs);
for ($i = 0 ; $i < $lenTab ; $i++) {
$jobID = rand(0, 100);
while (count($this->currentJobs) >= $this->maxProcesses) {
sleep($this->sleepTime);
}
$launched = $this->launchJobProcess($jobID, "Jobs", $jobs[$i]);
}
while (count($this->currentJobs)) {
sleep($this->sleepTime);
}
} | php | public function run($jobs)
{
$lenTab = count($jobs);
for ($i = 0 ; $i < $lenTab ; $i++) {
$jobID = rand(0, 100);
while (count($this->currentJobs) >= $this->maxProcesses) {
sleep($this->sleepTime);
}
$launched = $this->launchJobProcess($jobID, "Jobs", $jobs[$i]);
}
while (count($this->currentJobs)) {
sleep($this->sleepTime);
}
} | Run the Daemon | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Multithread.php#L24-L39 |
schpill/thin | src/Multithread.php | Multithread.launchJob | protected function launchJob($jobID)
{
$pid = pcntl_fork();
if ($pid == -1) {
error_log('Could not launch new job, exiting');
echo 'Could not launch new job, exiting';
return false;
} else if ($pid) {
$this->currentJobs[$pid] = $jobID;
if (isset($this->signalQueue[$pid])) {
$this->childSignalHandler(SIGCHLD, $pid, $this->signalQueue[$pid]);
unset($this->signalQueue[$pid]);
}
} else {
$exitStatus = 0; //Error code if you need to or whatever
exit($exitStatus);
}
return true;
} | php | protected function launchJob($jobID)
{
$pid = pcntl_fork();
if ($pid == -1) {
error_log('Could not launch new job, exiting');
echo 'Could not launch new job, exiting';
return false;
} else if ($pid) {
$this->currentJobs[$pid] = $jobID;
if (isset($this->signalQueue[$pid])) {
$this->childSignalHandler(SIGCHLD, $pid, $this->signalQueue[$pid]);
unset($this->signalQueue[$pid]);
}
} else {
$exitStatus = 0; //Error code if you need to or whatever
exit($exitStatus);
}
return true;
} | Launch a job from the job queue | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Multithread.php#L83-L101 |
rzajac/php-test-helper | src/Database/Driver/MySQL.php | MySQL.getTableNames | protected function getTableNames(): array
{
$dbName = $this->config[DbItf::DB_CFG_DATABASE];
$resp = $this->dbRunQuery(sprintf('SHOW FULL TABLES FROM `%s`', $dbName));
$tableAndViewNames = [];
while ($row = $resp->fetch_assoc()) {
$tableAndViewNames[] = array_change_key_case($row);
}
return $tableAndViewNames;
} | php | protected function getTableNames(): array
{
$dbName = $this->config[DbItf::DB_CFG_DATABASE];
$resp = $this->dbRunQuery(sprintf('SHOW FULL TABLES FROM `%s`', $dbName));
$tableAndViewNames = [];
while ($row = $resp->fetch_assoc()) {
$tableAndViewNames[] = array_change_key_case($row);
}
return $tableAndViewNames;
} | Return table and view names form the database.
@throws DatabaseEx
@return array | https://github.com/rzajac/php-test-helper/blob/37280e9ff639b25cf9413909cc080c5d8deb311c/src/Database/Driver/MySQL.php#L164-L175 |
QoboLtd/cakephp-translations | src/Controller/LanguagesController.php | LanguagesController.index | public function index()
{
$languages = $this->Languages->find('all');
$this->set(compact('languages'));
$this->set('_serialize', ['languages']);
} | php | public function index()
{
$languages = $this->Languages->find('all');
$this->set(compact('languages'));
$this->set('_serialize', ['languages']);
} | Index method
@return \Cake\Http\Response|void | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Controller/LanguagesController.php#L28-L33 |
QoboLtd/cakephp-translations | src/Controller/LanguagesController.php | LanguagesController.add | public function add()
{
$language = $this->Languages->newEntity();
if ($this->request->is('post')) {
$data = is_array($this->request->getData()) ? $this->request->getData() : [];
$languageEntity = $this->Languages->addOrRestore($data);
if (!empty($languageEntity)) {
$this->Flash->success((string)__('The language has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error((string)__('The language could not be saved. Please, try again.'));
}
$languages = $this->Languages->getAvailable();
$this->set(compact('language', 'languages'));
$this->set('_serialize', ['language']);
} | php | public function add()
{
$language = $this->Languages->newEntity();
if ($this->request->is('post')) {
$data = is_array($this->request->getData()) ? $this->request->getData() : [];
$languageEntity = $this->Languages->addOrRestore($data);
if (!empty($languageEntity)) {
$this->Flash->success((string)__('The language has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error((string)__('The language could not be saved. Please, try again.'));
}
$languages = $this->Languages->getAvailable();
$this->set(compact('language', 'languages'));
$this->set('_serialize', ['language']);
} | Add method
@return \Cake\Http\Response|void|null Redirects on successful add, renders view otherwise. | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Controller/LanguagesController.php#L40-L56 |
QoboLtd/cakephp-translations | src/Controller/LanguagesController.php | LanguagesController.delete | public function delete(string $id = null)
{
$this->request->allowMethod(['post', 'delete']);
$language = $this->Languages->get($id);
if ($this->Languages->delete($language)) {
$this->Flash->success((string)__('The language has been deleted.'));
} else {
$this->Flash->error((string)__('The language could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
} | php | public function delete(string $id = null)
{
$this->request->allowMethod(['post', 'delete']);
$language = $this->Languages->get($id);
if ($this->Languages->delete($language)) {
$this->Flash->success((string)__('The language has been deleted.'));
} else {
$this->Flash->error((string)__('The language could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
} | Delete method
@param string|null $id Language id.
@return \Cake\Http\Response|void|null Redirects to index.
@throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Controller/LanguagesController.php#L65-L76 |
graze/csv-token | src/Tokeniser/StateBuilder.php | StateBuilder.buildStates | public function buildStates(TokenStoreInterface $tokenStore)
{
$initial = new State($tokenStore, State::S_INITIAL_TOKENS);
$any = new State($tokenStore, State::S_ANY_TOKENS);
$inQuote = new State($tokenStore, State::S_IN_QUOTE_TOKENS);
$inEscape = new State($tokenStore, State::S_IN_ESCAPE_TOKENS);
$inQuoteEscape = new State($tokenStore, State::S_IN_QUOTE_ESCAPE_TOKENS);
$initial->addStateTarget(Token::T_ANY & ~Token::T_QUOTE & ~Token::T_ESCAPE, $any);
$initial->addStateTarget(Token::T_QUOTE, $inQuote);
$initial->addStateTarget(Token::T_ESCAPE, $inEscape);
// generate state mapping
$any->addStateTarget(Token::T_ANY & ~Token::T_QUOTE & ~Token::T_ESCAPE, $any);
$any->addStateTarget(Token::T_QUOTE, $inQuote);
$any->addStateTarget(Token::T_ESCAPE, $inEscape);
$inQuote->addStateTarget(Token::T_CONTENT | Token::T_DOUBLE_QUOTE, $inQuote);
$inQuote->addStateTarget(Token::T_QUOTE, $any);
$inQuote->addStateTarget(Token::T_ESCAPE, $inQuoteEscape);
$inEscape->addStateTarget(Token::T_CONTENT, $any);
$inQuoteEscape->addStateTarget(Token::T_CONTENT, $inQuote);
return $initial;
} | php | public function buildStates(TokenStoreInterface $tokenStore)
{
$initial = new State($tokenStore, State::S_INITIAL_TOKENS);
$any = new State($tokenStore, State::S_ANY_TOKENS);
$inQuote = new State($tokenStore, State::S_IN_QUOTE_TOKENS);
$inEscape = new State($tokenStore, State::S_IN_ESCAPE_TOKENS);
$inQuoteEscape = new State($tokenStore, State::S_IN_QUOTE_ESCAPE_TOKENS);
$initial->addStateTarget(Token::T_ANY & ~Token::T_QUOTE & ~Token::T_ESCAPE, $any);
$initial->addStateTarget(Token::T_QUOTE, $inQuote);
$initial->addStateTarget(Token::T_ESCAPE, $inEscape);
// generate state mapping
$any->addStateTarget(Token::T_ANY & ~Token::T_QUOTE & ~Token::T_ESCAPE, $any);
$any->addStateTarget(Token::T_QUOTE, $inQuote);
$any->addStateTarget(Token::T_ESCAPE, $inEscape);
$inQuote->addStateTarget(Token::T_CONTENT | Token::T_DOUBLE_QUOTE, $inQuote);
$inQuote->addStateTarget(Token::T_QUOTE, $any);
$inQuote->addStateTarget(Token::T_ESCAPE, $inQuoteEscape);
$inEscape->addStateTarget(Token::T_CONTENT, $any);
$inQuoteEscape->addStateTarget(Token::T_CONTENT, $inQuote);
return $initial;
} | @param TokenStoreInterface $tokenStore
@return State The default starting state | https://github.com/graze/csv-token/blob/ad11cfc83e7f0cae56da6844f9216bbaf5c8dcb8/src/Tokeniser/StateBuilder.php#L26-L52 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.slashDirname | public static function slashDirname($dirname = null)
{
if (is_null($dirname) || empty($dirname)) {
return '';
}
return rtrim($dirname, '/ '.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
} | php | public static function slashDirname($dirname = null)
{
if (is_null($dirname) || empty($dirname)) {
return '';
}
return rtrim($dirname, '/ '.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
} | Get a dirname with one and only trailing slash
@param string $dirname
@return string | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L43-L49 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.isGitClone | public static function isGitClone($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
$dir_path = self::slashDirname($path).'.git';
return (bool) (file_exists($dir_path) && is_dir($dir_path));
} | php | public static function isGitClone($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
$dir_path = self::slashDirname($path).'.git';
return (bool) (file_exists($dir_path) && is_dir($dir_path));
} | Test if a path seems to be a git clone
@param string $path
@return bool | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L57-L64 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.isDotPath | public static function isDotPath($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
return (bool) ('.'===substr(basename($path), 0, 1));
} | php | public static function isDotPath($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
return (bool) ('.'===substr(basename($path), 0, 1));
} | Test if a filename seems to have a dot as first character
@param string $path
@return bool | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L72-L78 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.remove | public static function remove($path, $parent = true)
{
$ok = true;
if (true===self::ensureExists($path)) {
if (false===@is_dir($path) || true===is_link($path)) {
return @unlink($path);
}
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path),
\RecursiveIteratorIterator::SELF_FIRST | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS
);
foreach($iterator as $item) {
if (in_array($item->getFilename(), array('.', '..'))) {
continue;
}
if ($item->isDir()) {
$ok = self::remove($item);
} else {
$ok = @unlink($item);
}
}
if ($ok && $parent) {
@rmdir($path);
}
@clearstatcache();
}
return $ok;
} | php | public static function remove($path, $parent = true)
{
$ok = true;
if (true===self::ensureExists($path)) {
if (false===@is_dir($path) || true===is_link($path)) {
return @unlink($path);
}
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($path),
\RecursiveIteratorIterator::SELF_FIRST | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS
);
foreach($iterator as $item) {
if (in_array($item->getFilename(), array('.', '..'))) {
continue;
}
if ($item->isDir()) {
$ok = self::remove($item);
} else {
$ok = @unlink($item);
}
}
if ($ok && $parent) {
@rmdir($path);
}
@clearstatcache();
}
return $ok;
} | Try to remove a path
@param string $path
@param bool $parent
@return bool | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L117-L144 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.parseIni | public static function parseIni($path)
{
if (true===@file_exists($path)) {
$data = parse_ini_file($path, true);
if ($data && !empty($data)) {
return $data;
}
}
return false;
} | php | public static function parseIni($path)
{
if (true===@file_exists($path)) {
$data = parse_ini_file($path, true);
if ($data && !empty($data)) {
return $data;
}
}
return false;
} | Read and parse a INI content file
@param $path
@return array|bool | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L152-L161 |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.parseJson | public static function parseJson($path)
{
if (true===@file_exists($path)) {
$ctt = file_get_contents($path);
if ($ctt!==false) {
$data = json_decode($ctt, true);
if ($data && !empty($data)) {
return $data;
}
}
}
return false;
} | php | public static function parseJson($path)
{
if (true===@file_exists($path)) {
$ctt = file_get_contents($path);
if ($ctt!==false) {
$data = json_decode($ctt, true);
if ($data && !empty($data)) {
return $data;
}
}
}
return false;
} | Read and parse a JSON content file
@param $path
@return bool|mixed | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L169-L181 |
PhoxPHP/Glider | src/Console/Command/Migration.php | Migration.run | public function run(Array $argumentsList, int $argumentsCount)
{
$command = $argumentsList[0];
unset($argumentsList[0]);
$arguments = array_values($argumentsList);
$this->migrator->createMigrationsTable();
switch ($command) {
case 'create':
return $this->create();
break;
case 'run':
return $this->processMigrations();
break;
case 'run-class':
return $this->processMigration($arguments);
break;
default:
return $this->env->sendOutput('No command run.');
break;
}
} | php | public function run(Array $argumentsList, int $argumentsCount)
{
$command = $argumentsList[0];
unset($argumentsList[0]);
$arguments = array_values($argumentsList);
$this->migrator->createMigrationsTable();
switch ($command) {
case 'create':
return $this->create();
break;
case 'run':
return $this->processMigrations();
break;
case 'run-class':
return $this->processMigration($arguments);
break;
default:
return $this->env->sendOutput('No command run.');
break;
}
} | {@inheritDoc} | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Console/Command/Migration.php#L90-L112 |
PhoxPHP/Glider | src/Console/Command/Migration.php | Migration.create | protected function create(Array $arguments=[])
{
$migrationsDirectory = $this->cmd->getConfigOpt('migrations_storage');
$templateTags = [];
$migrationName = $this->cmd->question('Migration filename?');
$filename = trim($migrationName);
$path = $migrationsDirectory . '/' . $filename . '.php';
if (file_exists($path)) {
throw new MigrationFileInvalidException(
sprintf(
'Migration file [%s] exists.',
$filename
)
);
}
$templateTags['phx:class'] = Helper::getQualifiedClassName($filename);
$builder = new TemplateBuilder($this->cmd, $this->env);
$builder->createClassTemplate('migration', $filename, $migrationsDirectory, $templateTags);
// After migration class has been created, the record needs to go to the database and be set to pending.
$model = new Model();
$model->class_name = $templateTags['phx:class'];
$model->status = Attribute::STATUS_PENDING;
$model->path = $path;
$model->save();
$this->env->sendOutput('Created migration is now pending', 'green');
} | php | protected function create(Array $arguments=[])
{
$migrationsDirectory = $this->cmd->getConfigOpt('migrations_storage');
$templateTags = [];
$migrationName = $this->cmd->question('Migration filename?');
$filename = trim($migrationName);
$path = $migrationsDirectory . '/' . $filename . '.php';
if (file_exists($path)) {
throw new MigrationFileInvalidException(
sprintf(
'Migration file [%s] exists.',
$filename
)
);
}
$templateTags['phx:class'] = Helper::getQualifiedClassName($filename);
$builder = new TemplateBuilder($this->cmd, $this->env);
$builder->createClassTemplate('migration', $filename, $migrationsDirectory, $templateTags);
// After migration class has been created, the record needs to go to the database and be set to pending.
$model = new Model();
$model->class_name = $templateTags['phx:class'];
$model->status = Attribute::STATUS_PENDING;
$model->path = $path;
$model->save();
$this->env->sendOutput('Created migration is now pending', 'green');
} | Creates a migration.
@param $arguments <Array>
@access protected
@return <void> | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Console/Command/Migration.php#L145-L177 |
PhoxPHP/Glider | src/Console/Command/Migration.php | Migration.processMigration | protected function processMigration(Array $arguments)
{
$migrationClass = $arguments[0];
$migration = Model::findByclass_name($migrationClass);
if (!$migration) {
throw new MigrationClassNotFoundException(
sprintf(
'Migration class [%s] does not exist',
$migrationClass
)
);
}
if (isset($arguments[1]) && $arguments[1] == '--down') {
self::$migrationType = Attribute::DOWNGRADE;
}
$this->migrator->runSingleMigration($migration);
} | php | protected function processMigration(Array $arguments)
{
$migrationClass = $arguments[0];
$migration = Model::findByclass_name($migrationClass);
if (!$migration) {
throw new MigrationClassNotFoundException(
sprintf(
'Migration class [%s] does not exist',
$migrationClass
)
);
}
if (isset($arguments[1]) && $arguments[1] == '--down') {
self::$migrationType = Attribute::DOWNGRADE;
}
$this->migrator->runSingleMigration($migration);
} | Processes a specific migration.
@param $arguments <Array>
@access protected
@return <void> | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Console/Command/Migration.php#L199-L218 |
iwyg/xmlconf | src/Thapp/XmlConf/Cache/Cache.php | Cache.isNew | public function isNew($file)
{
list($filemtime, $lastmodified) = $this->getCacheModificationDate($file);
return $filemtime > $lastmodified;
} | php | public function isNew($file)
{
list($filemtime, $lastmodified) = $this->getCacheModificationDate($file);
return $filemtime > $lastmodified;
} | {@inheritDoc} | https://github.com/iwyg/xmlconf/blob/1d8a657073f3fd46dacfb6bf5d173f9d5283661b/src/Thapp/XmlConf/Cache/Cache.php#L64-L68 |
iwyg/xmlconf | src/Thapp/XmlConf/Cache/Cache.php | Cache.write | public function write($data)
{
$this->storage->forget($this->getStorageKey() . '.lasmodified');
$this->storage->forget($this->getStorageKey());
$this->storage->forever($this->getStorageKey() . '.lasmodified', time());
$this->storage->forever($this->getStorageKey(), $data);
} | php | public function write($data)
{
$this->storage->forget($this->getStorageKey() . '.lasmodified');
$this->storage->forget($this->getStorageKey());
$this->storage->forever($this->getStorageKey() . '.lasmodified', time());
$this->storage->forever($this->getStorageKey(), $data);
} | {@inheritDoc} | https://github.com/iwyg/xmlconf/blob/1d8a657073f3fd46dacfb6bf5d173f9d5283661b/src/Thapp/XmlConf/Cache/Cache.php#L81-L88 |
iwyg/xmlconf | src/Thapp/XmlConf/Cache/Cache.php | Cache.getCacheModificationDate | protected function getCacheModificationDate($file)
{
$storageKey = $this->getStorageKey() . '.lasmodified';
$filemtime = filemtime($file);
$lastmodified = $this->storage->has($storageKey) ? $this->storage->get($storageKey) : $filemtime - 1;
return array($filemtime, $lastmodified);
} | php | protected function getCacheModificationDate($file)
{
$storageKey = $this->getStorageKey() . '.lasmodified';
$filemtime = filemtime($file);
$lastmodified = $this->storage->has($storageKey) ? $this->storage->get($storageKey) : $filemtime - 1;
return array($filemtime, $lastmodified);
} | Returns the modification date of a given file and the the
date of the last cache write.
@access protected
@return array | https://github.com/iwyg/xmlconf/blob/1d8a657073f3fd46dacfb6bf5d173f9d5283661b/src/Thapp/XmlConf/Cache/Cache.php#L97-L104 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.create | public function create(array $metadata = array())
{
if (is_file($this->file)) {
return false;
}
$this->createTemporaryFolder();
file_put_contents($this->file, $this->placeholderContent($metadata), LOCK_EX);
return true;
} | php | public function create(array $metadata = array())
{
if (is_file($this->file)) {
return false;
}
$this->createTemporaryFolder();
file_put_contents($this->file, $this->placeholderContent($metadata), LOCK_EX);
return true;
} | Creates the file. It creates a placeholder file with some metadata on it and will
create all the temporary files and folders.
Writing without creating first will throw an exception. Creating twice will not throw an
exception but will return false. That means it is OK to call `create()` before calling
`write()`. Ideally it should be called once when the writing of the file is initialized.
@param array $metadata
@return bool | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L72-L82 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.createTemporaryFolder | protected function createTemporaryFolder()
{
Util::mkdir($this->blocks);
Util::mkdir(dirname($this->file));
file_put_contents($this->tmp . '.lock', '', LOCK_EX);
} | php | protected function createTemporaryFolder()
{
Util::mkdir($this->blocks);
Util::mkdir(dirname($this->file));
file_put_contents($this->tmp . '.lock', '', LOCK_EX);
} | Creates the needed temporary files and folders in prepartion for
the file writer. | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L88-L93 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.write | public function write($offset, $input, $limit = -1)
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("Cannot write into the file");
}
$block = new BlockWriter($this->blocks . $offset, $this->tmp);
$wrote = $block->write($input, $limit);
$block->commit();
return $block;
} | php | public function write($offset, $input, $limit = -1)
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("Cannot write into the file");
}
$block = new BlockWriter($this->blocks . $offset, $this->tmp);
$wrote = $block->write($input, $limit);
$block->commit();
return $block;
} | Writes content to this file. This writer must provide the $offset where this data is going to
be written. The $content maybe a stream (the output of `fopen()`) or a string. Both type of `$content`
can have a `$limit` to limit the number of bytes that are written.
@param int $offset
@param string|stream $content
@param int $limit
@return BlockWriter Return the BlockWriter object. | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L122-L132 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.getWroteBlocks | public function getWroteBlocks()
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("cannot obtain the blocks ({$this->blocks})");
}
$files = array_filter(array_map(function($file) {
$basename = basename($file);
if (!is_numeric($basename)) {
return false;
}
return [
'offset' => (int)$basename,
'file' => $file,
'size' => filesize($file)
];
}, glob($this->blocks . "*")));
uasort($files, function($a, $b) {
return $a['offset'] - $b['offset'];
});
return $files;
} | php | public function getWroteBlocks()
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("cannot obtain the blocks ({$this->blocks})");
}
$files = array_filter(array_map(function($file) {
$basename = basename($file);
if (!is_numeric($basename)) {
return false;
}
return [
'offset' => (int)$basename,
'file' => $file,
'size' => filesize($file)
];
}, glob($this->blocks . "*")));
uasort($files, function($a, $b) {
return $a['offset'] - $b['offset'];
});
return $files;
} | Returns all the wrote blocks of files. All the blocks are sorted by their offset.
@return array | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L139-L161 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.getMissingBlocks | public function getMissingBlocks(Array $blocks = array())
{
$missing = array();
$blocks = $blocks ? $blocks : $this->getWroteBlocks();
$last = array_shift($blocks);
if ($last['offset'] !== 0) {
$missing[] = array('offset' => 0, 'size' => $last['offset']);
}
foreach ($blocks as $block) {
if ($block['offset'] !== $last['offset'] + $last['size']) {
$offset = $last['offset'] + $last['size'];
$missing[] = array('offset' => $offset, 'size' => $block['offset'] - $offset);
}
$last = $block;
}
return $missing;
} | php | public function getMissingBlocks(Array $blocks = array())
{
$missing = array();
$blocks = $blocks ? $blocks : $this->getWroteBlocks();
$last = array_shift($blocks);
if ($last['offset'] !== 0) {
$missing[] = array('offset' => 0, 'size' => $last['offset']);
}
foreach ($blocks as $block) {
if ($block['offset'] !== $last['offset'] + $last['size']) {
$offset = $last['offset'] + $last['size'];
$missing[] = array('offset' => $offset, 'size' => $block['offset'] - $offset);
}
$last = $block;
}
return $missing;
} | Returns the empty blocks in a file, if any gap is missing `finalize()`
will fail and will throw an exception.
@param $blocks Provides the list of blocks, otherwise `getWroteBlocks()` will
be called.
@return array | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L172-L191 |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.finalize | public function finalize()
{
if (!is_file($this->tmp . '.lock')) {
throw new RuntimeException("File is already completed");
}
$lock = fopen($this->tmp . '.lock', 'r+');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
return false;
}
$blocks = $this->getWroteBlocks();
$missing = $this->getMissingBlocks($blocks);
if (!empty($missing)) {
flock($lock, LOCK_UN);
fclose($lock);
throw new RuntimeException("File is incomplete, cannot finalize it");
}
$file = new BlockWriter($this->file, $this->tmp);
$fp = $file->getStream();
foreach ($blocks as $block) {
$tmp = fopen($block['file'], 'r');
fseek($fp, $block['offset']);
stream_copy_to_stream($tmp, $fp);
fclose($tmp);
}
$file->commit();
Util::delete($this->tmp);
flock($lock, LOCK_UN);
fclose($lock); // We do not release the lock on porpuse.
return true;
} | php | public function finalize()
{
if (!is_file($this->tmp . '.lock')) {
throw new RuntimeException("File is already completed");
}
$lock = fopen($this->tmp . '.lock', 'r+');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
return false;
}
$blocks = $this->getWroteBlocks();
$missing = $this->getMissingBlocks($blocks);
if (!empty($missing)) {
flock($lock, LOCK_UN);
fclose($lock);
throw new RuntimeException("File is incomplete, cannot finalize it");
}
$file = new BlockWriter($this->file, $this->tmp);
$fp = $file->getStream();
foreach ($blocks as $block) {
$tmp = fopen($block['file'], 'r');
fseek($fp, $block['offset']);
stream_copy_to_stream($tmp, $fp);
fclose($tmp);
}
$file->commit();
Util::delete($this->tmp);
flock($lock, LOCK_UN);
fclose($lock); // We do not release the lock on porpuse.
return true;
} | Finalizes writing a file. The finalization of a file means check that there are no gap or missing
block in a file, lock the file (so no other write may happen or another `finalize()`).
In here, after locking, all the blocks are merged into a single file. When the merging is ready,
we rename the temporary file as the filename we expected. When that process is done, all the blocks
files are deleted and the file is ready.
@return bool | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L203-L238 |
DimNS/MFLPHP | src/Pages/User/ActionLogin.php | ActionLogin.run | public function run($user_email, $user_pass)
{
$result = [
'error' => true,
'message' => 'Неизвестная ошибка.',
];
$loginResult = $this->di->auth->login($user_email, $user_pass, false);
if ($loginResult['error'] === false) {
$user_id = $this->di->auth->getUID($user_email);
if ($user_id !== false) {
$user_info = \ORM::for_table('users_info')
->where_equal('uid', $user_id)
->find_one();
if (is_object($user_info)) {
$user_info->last_login = $this->di->carbon->toDateTimeString();
$user_info->save();
setcookie($this->di->auth->config->cookie_name, $loginResult['hash'], $loginResult['expire'], $this->di->auth->config->cookie_path, $this->di->auth->config->cookie_domain, $this->di->auth->config->cookie_secure, $this->di->auth->config->cookie_http);
return [
'error' => false,
'message' => 'Добро пожаловать!',
];
} else {
$result['message'] = 'Произошла ошибка при изменении данных. Попробуйте войти ещё раз.';
}
} else {
$result['message'] = 'Данные пользователя не найдены. Попробуйте войти ещё раз.';
}
} else {
$result['message'] = $loginResult['message'];
}
return $result;
} | php | public function run($user_email, $user_pass)
{
$result = [
'error' => true,
'message' => 'Неизвестная ошибка.',
];
$loginResult = $this->di->auth->login($user_email, $user_pass, false);
if ($loginResult['error'] === false) {
$user_id = $this->di->auth->getUID($user_email);
if ($user_id !== false) {
$user_info = \ORM::for_table('users_info')
->where_equal('uid', $user_id)
->find_one();
if (is_object($user_info)) {
$user_info->last_login = $this->di->carbon->toDateTimeString();
$user_info->save();
setcookie($this->di->auth->config->cookie_name, $loginResult['hash'], $loginResult['expire'], $this->di->auth->config->cookie_path, $this->di->auth->config->cookie_domain, $this->di->auth->config->cookie_secure, $this->di->auth->config->cookie_http);
return [
'error' => false,
'message' => 'Добро пожаловать!',
];
} else {
$result['message'] = 'Произошла ошибка при изменении данных. Попробуйте войти ещё раз.';
}
} else {
$result['message'] = 'Данные пользователя не найдены. Попробуйте войти ещё раз.';
}
} else {
$result['message'] = $loginResult['message'];
}
return $result;
} | Выполним действие
@param string $user_email Адрес электронной почты
@param string $user_pass Пароль пользователя
@return array
@version 22.04.2017
@author Дмитрий Щербаков <[email protected]> | https://github.com/DimNS/MFLPHP/blob/8da06f3f9aabf1da5796f9a3cea97425b30af201/src/Pages/User/ActionLogin.php#L26-L62 |
rackberg/para | src/Command/ListAvailablePluginsCommand.php | ListAvailablePluginsCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$plugins = $this->pluginManager->fetchPluginsAvailable();
if (!$plugins) {
$output->writeln('No available plugins could be found at the moment!');
return;
}
$rows = [];
foreach ($plugins as $plugin) {
$rows[] = [
$plugin->getName(),
$plugin->getDescription(),
$plugin->getVersion(),
];
}
$table = $this->tableOutputFactory->getTable($output);
$table->setHeaders(['Plugin', 'Description', 'Version']);
$table->setRows($rows);
$table->render();
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$plugins = $this->pluginManager->fetchPluginsAvailable();
if (!$plugins) {
$output->writeln('No available plugins could be found at the moment!');
return;
}
$rows = [];
foreach ($plugins as $plugin) {
$rows[] = [
$plugin->getName(),
$plugin->getDescription(),
$plugin->getVersion(),
];
}
$table = $this->tableOutputFactory->getTable($output);
$table->setHeaders(['Plugin', 'Description', 'Version']);
$table->setRows($rows);
$table->render();
} | {@inheritdoc} | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/Command/ListAvailablePluginsCommand.php#L62-L83 |
nyeholt/silverstripe-performant | code/model/DataObjectNode.php | DataObjectNode.isSection | public function isSection() {
if ($this->isCurrent()) {
return true;
}
$ancestors = $this->getAncestors();
if (Director::get_current_page() instanceof Page) {
$node = Director::get_current_page()->asMenuItem();
if ($node) {
$ancestors = $node->getAncestors();
return $ancestors && in_array($this->ID, $node->getAncestors()->column());
}
}
return false;
} | php | public function isSection() {
if ($this->isCurrent()) {
return true;
}
$ancestors = $this->getAncestors();
if (Director::get_current_page() instanceof Page) {
$node = Director::get_current_page()->asMenuItem();
if ($node) {
$ancestors = $node->getAncestors();
return $ancestors && in_array($this->ID, $node->getAncestors()->column());
}
}
return false;
} | Check if this page is in the currently active section (e.g. it is either current or one of its children is
currently being viewed).
@return bool | https://github.com/nyeholt/silverstripe-performant/blob/2c9d2570ddf4a43ced38487184da4de453a4863c/code/model/DataObjectNode.php#L70-L84 |