/** * Attempts to find a controller class for the given view template path. * * @param string $viewName A view template absolute file path. * @return null|string null if no controller was found. */ function findControllerForView($viewName) { /** @var DocumentContext $this */ $path = $this->viewService->resolveTemplatePath($viewName, $base); // inspect ($viewName, $base, $path); if (isset($this->controllers[$path])) { return $this->controllers[$path]; } foreach ($this->controllerNamespaces as $nsPath => $ns) { // inspect ($nsPath, $ns); if (str_beginsWith($path, $nsPath)) { $remaining = substr($path, strlen($nsPath) + 1); $a = PS($remaining)->split('/'); $file = $a->pop(); $nsPrefix = $a->map('ucfirst', false)->join('\\')->S; $class = ($p = strpos($file, '.')) !== false ? ucfirst(substr($file, 0, $p)) : ucfirst($file); $FQN = PA([$ns, $nsPrefix, $class])->prune()->join('\\')->S; // inspect ("CLASS $FQN"); if (class_exists($FQN)) { return $FQN; } } } // inspect ("CLASS NOT FOUND FOR VIEW $viewName"); return null; }
function __debugInfo() { $linkToUrl = function (NavigationLinkInterface $link) { return $link->rawUrl(); }; return ['Current link' => $this->currentLink(), 'All IDs<sup>*</sup>' => PA($this->IDs)->keys()->sort()->join(', ')->S, 'All URLs<sup>*</sup><br>' . '<i>(in scanning order)</i>' => map($this->rootLink->getDescendants(), function (NavigationLinkInterface $link, &$i) { $i = $link->rawUrl(); return $link->url(); }), 'Trail<sup>*</sup>' => map($this->getCurrentTrail(), $linkToUrl), 'Visible trail<sup>*</sup>' => map($this->getVisibleTrail(), $linkToUrl), 'Navigation map<sup>*</sup>' => iterator_to_array($this->rootLink), 'request' => $this->request()]; }
<?php /** * Function to print array with pre tag * * @param array $array */ function PA($array) { echo '<pre>', print_r($array, true), '</pre>'; } // include pdo class wrapper include_once 'class.pdowrapper.php'; // create new object of class wrapper $p = new PdoWrapper(); // simple delete #1 // where condition array $aWhere = array('age' => 35); // call update function $q = $p->delete('test', $aWhere)->traceEnable()->affectedRows(); // print affected rows PA($q); // simple delete #2 // where condition array $aWhere = array('age' => 45, 'first_name' => 'Sonu'); // call update function $q = $p->delete('test', $aWhere)->traceEnable()->affectedRows(); // print affected rows PA($q);
function rollBack($target = null, $date = null, $pretend = false) { $this->assertModuleIsSet(); $all = $this->getAllMigrations(); $done = PA($all)->findAll(Migration::status, Migration::DONE)->orderBy(Migration::date, SORT_DESC)->A; $obsolete = PA($all)->findAll(Migration::status, Migration::OBSOLETE)->orderBy(Migration::date, SORT_DESC)->A; // SIMULATE if ($pretend) { return $this->pretendRollBackMigrations($obsolete) . $this->pretendRollBackMigrations($done); } // ROLL BACK return $this->rollBackMigrations($obsolete) + $this->rollBackMigrations($done); }