function out(Collector $collector, $showClassNames = false) { $cli = $this->cli; foreach ($collector->callCounts($showClassNames) as $name => $callFn) { $firstCall = current($callFn)['callInfo']; $firstEntry = $firstCall[Collector::CALL_INFO]->entry; $cli->lightGreen()->bold()->out($firstEntry->function); $headerColour = 'light_blue'; $rows = []; $hdr = ["<{$headerColour}>calls</{$headerColour}>", "<{$headerColour}>arg1</{$headerColour}>"]; $sigRow = []; $maxCols = 1; if (isset($signatures[$name])) { $sig = $signatures[$name]; $sigRow[] = "<{$headerColour}>calls</{$headerColour}>"; foreach ($sig['argv'] as $name => $arg) { $sigRow[] = "<{$headerColour}>" . caper_function_param_str($name, $arg) . "</{$headerColour}>"; } } foreach ($callFn as $idx => $callCount) { list($name, $traceId, $call, $stack) = $callCount['callInfo']; $row = $callCount['aggregate']; array_unshift($row, "x{$callCount['count']}"); $maxCols = max(count($callCount['aggregate']) + 1, $maxCols); $rows["{$callCount['count']}|{$idx}"] = $row; } krsort($rows, SORT_NUMERIC); for ($i = 2; $i < $maxCols; $i++) { $hdr[$i] = "<{$headerColour}>{$i}</{$headerColour}>"; } array_unshift($rows, $sigRow ?: $hdr); $cli->columns($rows, $maxCols); $cli->br(); } }
public function hookInstall() { //set up my Collectors table $db = get_db(); $sql = "\n CREATE TABLE IF NOT EXISTS `{$db->Collector}` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `collection_id` int(10) unsigned NOT NULL,\n `name` TEXT NOT NULL,\n `bio` TEXT NOT NULL,\n `public` tinyint(1) default '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"; $db->query($sql); //set up some fake data to work with //this is the kind of work that is usually done in a Controller when processing a form $collection = new Collection(); $collection->name = "Fake Collection"; $collection->owner_id = 1; $collection->save(); $collector = new Collector(); $collector->name = "Mr. Fake Collector"; $collector->collection_id = $collection->id; $collector->bio = "I collected stuff for the Fake Collection"; $collector->public = 1; $collector->save(); $collector = new Collector(); $collector->name = "Mysterious Ghost Collector"; $collector->collection_id = $collection->id; $collector->bio = "I collected stuff for the Fake Collection, but in secret so I don't want the public to know"; $collector->public = 0; $collector->save(); $collection = new Collection(); $collection->name = "Pseudo Collection"; $collection->owner_id = 1; $collection->save(); $collector = new Collector(); $collector->name = "Mrs. Pseudo Collector"; $collector->collection_id = $collection->id; $collector->bio = "I collected stuff for the Pseudo Collection"; $collector->public = 1; $collector->save(); }
public function process() { $results = $this->collector->get(); $functions = $this->config->get_functions(); foreach ($results as $result) { if (!isset($functions[$result['function']])) { continue; } $function_data = $functions[$result['function']]; if (isset($this->handlers[$function_data['type']])) { $this->handlers[$function_data['type']]->add($result); } } }
public function showMain() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } foreach ($blocks as $index => $block) { $blocks[$block->slug] = $block; unset($blocks[$index]); } $allRates = Cache::tags('rates')->rememberForever('rates_' . App::getLocale(), function () { return Rates::orderPriority()->get(); }); $rates = array(); foreach ($allRates as $i => $rate) { if ($rate['type'] == 1) { $rates['departments'][] = $rate; } else { $rates['cards'][$rate['name_card']][] = $rate; } } $calculatorCredit = new CashCalculator(); // fixme: //$calculatorCredit->setMonthlyIncome(Settings::get('monthly_income_default', 0)); $calculatorCredit->setCreditAmount(Settings::get('credit_amount_default', 100000)); $calculatorCredit->setTerm(Settings::get('term_default', 3)); $calculationsCredit = $calculatorCredit->calculate(); return View::make('index', compact('page', 'blocks', 'rates', 'calculationsCredit')); }
public function instantiate(NameSource $name_source) { $l = $this->_l->instantiate($name_source); $r = $this->_r->instantiate($l["name_source"]); $collector = Collector::combineCollectors($l["collector"], $r["collector"]); return array("builder" => new CombinedBuilder($l["builder"], $r["builder"]), "collector" => $collector, "name_source" => $r["name_source"]); }
public function showRisksManagement() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $risks = null; if ($subTree) { $risks = $subTree->children; } return View::make('investor.risks', compact('page', 'risks')); }
public function showSingle() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('small-business.single', compact('page', 'blocks')); }
public function test_getServiceItemsForMageSaleOrder() { /** === Test Data === */ $STORE_ID = 4; $STOCK_ID = 8; $ORDER = $this->_mock(\Magento\Sales\Api\Data\OrderInterface::class); /** === Mock object itself === */ $this->obj = \Mockery::mock(Collector::class . '[getServiceItemForMageItem]', $this->objArgs); /** === Setup Mocks === */ // $storeId = $order->getStoreId(); $ORDER->shouldReceive('getStoreId')->once()->andReturn($STORE_ID); // $stockId = $this->_manStock->getStockIdByStoreId($storeId); $this->mManStock->shouldReceive('getStockIdByStoreId')->once()->andReturn($STOCK_ID); // $items = $order->getItems(); $mItem = $this->_mock(\Magento\Sales\Api\Data\OrderItemInterface::class); $ORDER->shouldReceive('getItems')->once()->andReturn([$mItem]); // $itemData = $this->getServiceItemForMageItem($item, $stockId); $mItemData = $this->_mock(\Praxigento\Pv\Service\Sale\Data\Item::class); $this->obj->shouldReceive('getServiceItemForMageItem')->once()->andReturn($mItemData); /** === Call and asserts === */ $res = $this->obj->getServiceItemsForMageSaleOrder($ORDER); $this->assertTrue(is_array($res)); $this->assertTrue(count($res) > 0); }
public function showIndex() { $page = $this->node; $sliderItems = Cache::tags('slider_items')->rememberForever('corporate_business_slider_' . App::getLocale(), function () { return SliderItem::corporateBusiness()->active()->get(); }); $products = Cache::tags('j_tree')->rememberForever('corporate_business_products_' . App::getLocale(), function () use($page) { return $page->immediateDescendants()->where('is_active', 'like', '%' . App::getLocale() . '%')->get(); }); $partnership = null; foreach ($products as $index => $product) { if ($product->slug == 'partnership') { $partnership = $product; unset($products[$index]); } } $news = Cache::tags('news')->rememberForever('corporate_business_news_' . App::getLocale(), function () use($page) { return News::active()->byCatalog(Collector::get('idNewsCatalog'))->byCategories(Collector::get('idCorporateBusinessCategory'))->desc()->get(); }); return View::make('corporate-business.index', compact('page', 'sliderItems', 'products', 'partnership', 'news')); }
function MyDomIsList($url) { global $removetags, $removeattrs; $dom = new Collector(); $dom->setFilterTags($removetags)->setFilterAttrs($removeattrs)->getDomByUrl($url)->init(); if ($dom->score > 0) { $return = false; } else { $return = true; } return $return; }
</thead> <tbody> @if($payments->count() > 0 ) @foreach($payments as $row) <tr> <td>{{$row->id}}</td> <td>{{strftime("%d/%b/%Y",strtotime($row->created_at))}} </td> <td>{{date('h:ia', strtotime($row->created_at))}}</td> <td>{{$row->name}} {{$row->last_name}}</td> <td>{{$row->description}}</td> <td>${{number_format($row->amount,2,'.',',')}}</td> <?php $cobrador = Collector::join('users', 'users.id', '=', 'collectors.user_id')->join('neighbors', 'neighbors.user_id', '=', 'users.id')->where('collectors.id', '=', $row->collector_id)->first(); ?> <td>{{$cobrador->name}} {{$cobrador->last_name}}</td> <td>{{$row->coments}}</td> </tr> @endforeach @else <tr> <td colspan="7" >No Hay Registros.</td> </tr> @endif </tbody> </center>
public function showCreditRepay() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('about.credit_repay', compact('page', 'blocks')); }
public function __construct() { self::$db = new dataBase($this->username, $this->password, $this->host, $this->dbname); }
public function collect(Collector $collector) : Stream { $gen = $this->execute(); $supplied = $collector->supplier()->get(); while ($gen->valid()) { $supplied = $collector->accumulator()->apply($supplied, $gen->next()); $gen->next(); } return $collector->finisher()->apply($supplied); }
public function testSkipsCurrentWhenTargetPathHasTrailingBackslash() { $path = $this->getTestDataDir() . '/collector/static-dir/'; $filename = 'foo-%d.txt'; $target = new Target($path, $filename, strtotime('2014-12-07 04:30:57')); $collector = new Collector($target); $files = $collector->getBackupFiles(); $this->assertEquals(3, count($files), '3 files should be found'); }
/** * Get the list of results. * * @param SMWRequestOptions $requestOptions * @return array of SMWDIProperty|SMWDIError */ function getResults($requestOptions) { $this->collector = $this->store->getUnusedPropertiesSpecial($requestOptions); return $this->collector->getResults(); }
$cities = Cache::tags('cities')->rememberForever('cities_' . App::getLocale(), function () { return City::active()->get(); }); $shops = Cache::tags('shops')->rememberForever('shops_' . App::getLocale(), function () { return Shop::active()->get(); }); $products = Cache::tags('products')->rememberForever('products_' . App::getLocale(), function () { return Product::active()->get(); }); $view->with('cities', $cities)->with('shops', $shops)->with('products', $products); }); View::composer('partials.calculators.cards', function ($view) { $programs = Cache::tags('j_tree', 'cards_programs')->rememberForever('privates_cards_programs_' . App::getLocale(), function () { return CardProgram::active()->get(); }); $cards = Cache::tags('j_tree', 'cards')->rememberForever('privates_cards_' . App::getLocale(), function () { $cardsCatalog = Tree::find(Collector::get('idCardsCatalog')); return $cardsCatalog->immediateDescendants()->with('cardsPrograms')->active()->get(); }); $view->with('programs', $programs)->with('cards', $cards); }); View::composer('partials.calculators.want_multiply', function ($view) { $calculatorDeposit = new DepositCalculator(); $calculatorDeposit->setDepositAmount(Settings::get('deposit_amount_default', 100000)); $calculatorDeposit->setTerm(Settings::get('term_default', 3)); $calculatorDeposit->setMonthlyInstallment(0); $calculatorDeposit->setCurrency('uah'); $calculatorDeposit->setIsMain(true); $calculations = $calculatorDeposit->calculate(); $view->with('calculations', $calculations); });
public function config_store() { $user_id = Auth::user()->id; $num_street_id = NULL; $num_floor_id = NULL; $data = Input::all(); $name_floor = Input::get('name_floor'); $name_street = Input::get('name_street'); //~====================SAVE STEP 1=============================== $colony = new Colony(); $colony->location_id = Input::get('city'); $colony->name = Input::get('colony_name'); if ($colony->save()) { $created_colony = date('Y-m-j', strtotime($colony->created_at)); $newExpiration = strtotime('+1 month', strtotime($created_colony)); $newExpiration = date('Y-m-j', $newExpiration); $expiration = new Expiration(); $expiration->colony_id = $colony->id; $expiration->expiration = $newExpiration; $expiration->status = 1; $expiration->save(); $expiration_lic = new LicenseExpiration(); $expiration_lic->colony_id = $colony->id; $expiration_lic->expiration = null; $expiration_lic->save(); $datetime2 = new DateTime($expiration->expiration); $datetime1 = new DateTime(date('Y-m-d')); $interval = $datetime1->diff($datetime2); $days_expiration = $interval->format('%a'); Session::put('days_expiration', $days_expiration); $role = AssigmentRole::where('user_id', '=', $user_id)->where('role_id', '=', 2)->where('colony_id', '=', 0)->first(); if ($role) { $rol = AssigmentRole::findOrFail($role->id); $rol->colony_id = $colony->id; $rol->update(['id']); } else { $rol = new AssigmentRole(); $rol->user_id = $user_id; $rol->role_id = 2; $rol->colony_id = $colony->id; $rol->save(); } } $last_colony_add = $colony->id; $urbanism = new Urbanism(); $urbanism->colony_id = $last_colony_add; $urbanism->urbanism_type_id = Input::get('urbanism_type'); //$urbanism->name = Input::get('urbanism_name'); $urbanism->save(); $last_urbanism_add = $urbanism->id; $user_id = Auth::user()->id; $neighbor = Neighbors::where('user_id', '=', $user_id)->pluck('id'); if (!$neighbor) { $admin_colonies = new Neighbors(); $admin_colonies->user_id = $user_id; $admin_colonies->name = Input::get('admin_name'); $admin_colonies->last_name = Input::get('admin_lname'); $admin_colonies->phone = Input::get('admin_phone'); $admin_colonies->save(); $last_adminColonies_add = $admin_colonies->id; } if ($neighbor) { $last_adminColonies_add = $neighbor; } $streets = $data['streets']; if ($urbanism->urbanism_type_id == 3) { foreach ($streets as $Building_name) { $Building = new BuildingCatalog(); $Building->urbanism_id = $last_urbanism_add; $Building->description = $Building_name; $Building->save(); if ($Building_name == $name_floor) { $num_floor_id = $Building->id; } } } else { foreach ($streets as $street_name) { $street = new StreetCatalog(); $street->urbanism_id = $last_urbanism_add; $street->name = $street_name; $street->save(); if ($street_name == $name_street) { $num_street_id = $street->id; } } } $neighbor_properties = new NeighborProperty(); $neighbor_properties->neighbors_id = $last_adminColonies_add; $neighbor_properties->urbanism_id = $last_urbanism_add; $neighbor_properties->num_street_id = $num_street_id; $neighbor_properties->num_floor_id = $num_floor_id; $neighbor_properties->num_house_or_apartment = Input::get('num_house_or_apartment'); $neighbor_properties->status = 1; $neighbor_properties->save(); //~====================SAVE STEP 2=============================== $monthly_fee = new MonthlyFee(); $monthly_fee->urbanism_id = $last_urbanism_add; $monthly_fee->amount = Input::get('monthly_fee'); $monthly_fee->since = date("Y-m") . "-01"; $monthly_fee->until = NULL; $monthly_fee->save(); //~====================SAVE STEP 3=============================== //~====================sub cuentas egreso e ingreso por defecto =============================== $subAccounts_ingreso = new SubAccount(); $subAccounts_ingreso->account_id = 1; $subAccounts_ingreso->urbanism_id = $urbanism->id; $subAccounts_ingreso->description = 'Pago de cuota mensual'; $subAccounts_ingreso->save(); $subAccount_egreso = new SubAccount(); $subAccount_egreso->account_id = 2; $subAccount_egreso->urbanism_id = $urbanism->id; $subAccount_egreso->description = 'Nómina de guardias'; $subAccount_egreso->save(); $cobrador = Collector::where('user_id', '=', $user_id)->where('urbanism_id', '=', $urbanism->id)->pluck('id'); if (!$cobrador) { $collector = new Collector(); $collector->user_id = $user_id; $collector->urbanism_id = $urbanism->id; $collector->save(); } $campoEmail = Input::get('email'); if ($campoEmail) { $invited_neighbors = $data['mails']; $invited_id = md5(uniqid(mt_rand(), true)); foreach ($invited_neighbors as $neighbor_email) { $encrypted = Crypt::encrypt(md5(uniqid(mt_rand(), true))); $invited = new InvitedNeighbors(); $invited->neighbor_id = $last_adminColonies_add; $invited->invited_id = $invited_id; $invited->urbanism_id = $last_urbanism_add; $invited->email = $neighbor_email; $invited->confirmed = false; $invited->confirmation_code = $encrypted; $invited->save(); } return Redirect::action('HomeController@sendMailInvitation', array('invited_id' => $invited_id, 'admin_colonia' => $last_adminColonies_add, 'urbanismo' => $last_urbanism_add)); } else { return Redirect::action('NeighborController@admin_neighbor', array('admin_colonia' => $last_adminColonies_add, 'urbanismo' => $last_urbanism_add)); } }
public function __construct() { $this->settings = Collector::get('calculatorsSettings')['consumer']; $this->setPercent($this->settings['percent']); }
/** * Executes an sql statement and returns the results as an array * * @param string $query Query to execute. */ public function get_rows($query) { Collector::StartQuery($query); $res = $this->connection->query($query); Collector::EndQuery($query); while ($r = $res->fetchArray()) { $result[] = $r; } return $result; }
/** * Executes an sql statement and returns the results as an array * * @param string $query Query to execute. */ public function get_rows($query) { Collector::StartQuery($query); $res = pg_query($this->connection, $query); Collector::EndQuery($query); return pg_fetch_all($res); }
/** * Remove a header * * {@inheritdoc} * * @see DataCollection::remove() * @param string $key The key of the header * @return void */ public function remove($key) { $key = $this->normalizeKey($key); parent::remove($key); }
foreach ($calculatorsSettingsAll as $calculatorsSetting) { $calculatorsSettings[$calculatorsSetting->type][$calculatorsSetting->name] = $calculatorsSetting->value; } // supahacks Collector::set('idNewsCatalog', 964); Collector::set('idSmallBusinessCategory', array(4)); Collector::set('idCorporateBusinessCategory', array(2)); Collector::set('idInvestorRelationsCategory', array(7)); Collector::set('idAboutAchievements', 1179); Collector::set('idSmallBusinessDeposits', 45); Collector::set('idDepositsCatalog', 210); Collector::set('idCardsCatalog', 18); Collector::set('calculatorsSettings', $calculatorsSettings); // translates $translator = \Yaro\Jarboe\Helpers\Translate::getInstance(); Collector::set('translates', $translator->getAllStatic()); }); App::after(function ($request, $response) { // }); /* |-------------------------------------------------------------------------- | Authentication Filters |-------------------------------------------------------------------------- | | The following filters are used to verify that the user of the current | session is logged into this application. The "basic" filter easily | integrates HTTP Basic authentication for quick, simple checking. | */ Route::filter('auth', function () {
/** * Processes a single file. * * @param string $filename * @param bool $countTests */ public function countFile($filename, $countTests) { if ($countTests) { $this->preProcessFile($filename); } $buffer = file_get_contents($filename); $this->collector->incrementLines(substr_count($buffer, "\n")); $tokens = token_get_all($buffer); $numTokens = count($tokens); unset($buffer); $this->collector->addFile($filename); $blocks = []; $currentBlock = false; $namespace = false; $className = null; $functionName = null; $testClass = false; $this->collector->currentClassReset(); $isInMethod = false; for ($i = 0; $i < $numTokens; $i++) { if (is_string($tokens[$i])) { $token = trim($tokens[$i]); if ($token == ';') { if ($className !== null && !$testClass) { $this->collector->currentClassIncrementLines(); if ($functionName !== null) { $this->collector->currentMethodIncrementLines(); } } elseif ($functionName !== null) { $this->collector->incrementFunctionLines(); } $this->collector->incrementLogicalLines(); } elseif ($token == '?' && !$testClass) { if ($className !== null) { $this->collector->currentClassIncrementComplexity(); $this->collector->currentMethodIncrementComplexity(); } $this->collector->incrementComplexity(); } elseif ($token == '{') { if ($currentBlock == T_CLASS) { $block = $className; } elseif ($currentBlock == T_FUNCTION) { $block = $functionName; } else { $block = false; } array_push($blocks, $block); $currentBlock = false; } elseif ($token == '}') { $block = array_pop($blocks); if ($block !== false && $block !== null) { if ($block == $functionName) { $functionName = null; if ($isInMethod) { $this->collector->currentMethodStop(); $isInMethod = false; } } elseif ($block == $className) { $className = null; $testClass = false; $this->collector->currentClassReset(); } } } continue; } list($token, $value) = $tokens[$i]; switch ($token) { case T_NAMESPACE: $namespace = $this->getNamespaceName($tokens, $i); $this->collector->addNamespace($namespace); break; case T_CLASS: case T_INTERFACE: case T_TRAIT: if (!$this->isClassDeclaration($tokens, $i)) { continue; } $this->collector->currentClassReset(); $this->collector->currentClassIncrementComplexity(); $className = $this->getClassName($namespace, $tokens, $i); $currentBlock = T_CLASS; if ($token == T_TRAIT) { $this->collector->incrementTraits(); } elseif ($token == T_INTERFACE) { $this->collector->incrementInterfaces(); } else { if ($countTests && $this->isTestClass($className)) { $testClass = true; $this->collector->incrementTestClasses(); } else { if (isset($tokens[$i - 2]) && is_array($tokens[$i - 2]) && $tokens[$i - 2][0] == T_ABSTRACT) { $this->collector->incrementAbstractClasses(); } else { $this->collector->incrementConcreteClasses(); } } } break; case T_FUNCTION: $prev = $this->getPreviousNonWhitespaceTokenPos($tokens, $i); if ($tokens[$prev][0] === T_USE) { continue; } $currentBlock = T_FUNCTION; $next = $this->getNextNonWhitespaceTokenPos($tokens, $i); if (!is_array($tokens[$next]) && $tokens[$next] == '&') { $next = $this->getNextNonWhitespaceTokenPos($tokens, $next); } if (is_array($tokens[$next]) && $tokens[$next][0] == T_STRING) { $functionName = $tokens[$next][1]; } else { $currentBlock = 'anonymous function'; $functionName = 'anonymous function'; $this->collector->incrementAnonymousFunctions(); } if ($currentBlock == T_FUNCTION) { if ($className === null && $functionName != 'anonymous function') { $this->collector->incrementNamedFunctions(); } else { $static = false; $visibility = T_PUBLIC; for ($j = $i; $j > 0; $j--) { if (is_string($tokens[$j])) { if ($tokens[$j] == '{' || $tokens[$j] == '}' || $tokens[$j] == ';') { break; } continue; } if (isset($tokens[$j][0])) { switch ($tokens[$j][0]) { case T_PRIVATE: $visibility = T_PRIVATE; break; case T_PROTECTED: $visibility = T_PROTECTED; break; case T_STATIC: $static = true; break; } } } if ($testClass && $this->isTestMethod($functionName, $visibility, $static, $tokens, $i)) { $this->collector->incrementTestMethods(); } elseif (!$testClass) { $isInMethod = true; $this->collector->currentMethodStart(); if (!$static) { $this->collector->incrementNonStaticMethods(); } else { $this->collector->incrementStaticMethods(); } if ($visibility == T_PUBLIC) { $this->collector->incrementPublicMethods(); } else { $this->collector->incrementNonPublicMethods(); } } } } break; case T_CURLY_OPEN: $currentBlock = T_CURLY_OPEN; array_push($blocks, $currentBlock); break; case T_DOLLAR_OPEN_CURLY_BRACES: $currentBlock = T_DOLLAR_OPEN_CURLY_BRACES; array_push($blocks, $currentBlock); break; case T_IF: case T_ELSEIF: case T_FOR: case T_FOREACH: case T_WHILE: case T_CASE: case T_CATCH: case T_BOOLEAN_AND: case T_LOGICAL_AND: case T_BOOLEAN_OR: case T_LOGICAL_OR: if (!$testClass) { if ($isInMethod) { $this->collector->currentClassIncrementComplexity(); $this->collector->currentMethodIncrementComplexity(); } $this->collector->incrementComplexity(); } break; case T_COMMENT: case T_DOC_COMMENT: // We want to count all intermediate lines before the token ends // But sometimes a new token starts after a newline, we don't want to count that. // That happend with /* */ and /** */, but not with // since it'll end at the end $this->collector->incrementCommentLines(substr_count(rtrim($value, "\n"), "\n") + 1); break; case T_CONST: $this->collector->incrementClassConstants(); break; case T_STRING: if ($value == 'define') { $this->collector->incrementGlobalConstants(); $j = $i + 1; while (isset($tokens[$j]) && $tokens[$j] != ';') { if (is_array($tokens[$j]) && $tokens[$j][0] == T_CONSTANT_ENCAPSED_STRING) { $this->collector->addConstant(str_replace('\'', '', $tokens[$j][1])); break; } $j++; } } else { $this->collector->addPossibleConstantAccesses($value); } break; case T_DOUBLE_COLON: case T_OBJECT_OPERATOR: $n = $this->getNextNonWhitespaceTokenPos($tokens, $i); $nn = $this->getNextNonWhitespaceTokenPos($tokens, $n); if ($n && $nn && isset($tokens[$n][0]) && ($tokens[$n][0] == T_STRING || $tokens[$n][0] == T_VARIABLE) && $tokens[$nn] == '(') { if ($token == T_DOUBLE_COLON) { $this->collector->incrementStaticMethodCalls(); } else { $this->collector->incrementNonStaticMethodCalls(); } } else { if ($token == T_DOUBLE_COLON && $tokens[$n][0] == T_VARIABLE) { $this->collector->incrementStaticAttributeAccesses(); } elseif ($token == T_OBJECT_OPERATOR) { $this->collector->incrementNonStaticAttributeAccesses(); } } break; case T_GLOBAL: $this->collector->incrementGlobalVariableAccesses(); break; case T_VARIABLE: if ($value == '$GLOBALS') { $this->collector->incrementGlobalVariableAccesses(); } elseif (isset($this->superGlobals[$value])) { $this->collector->incrementSuperGlobalVariableAccesses(); } break; } } }
public function asignarRol() { $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $datos = (string) Input::get("rol"); $array = explode(",", $datos); $num = count($array); for ($i = 0; $i < $num; $i++) { $roles = explode(".", $array[$i]); $id = (int) $roles[1]; $rol = (int) $roles[0]; $urb = (int) $roles[2]; //$permisos = Permisos::all(); //$permisos = Permisos::find($id); Permisos::where("user_id", "=", $id)->where("colony_id", "=", Session::get("colonia"))->update(array("role_id" => $rol)); $BuscarCollector = Collector::where("user_id", "=", $id)->where('urbanism_id', '=', $urbanism->id)->orderBy('updated_at', 'desc')->first(); if ($rol == 2 || $rol == 3 || $rol == 4 || $rol == 5) { if (!$BuscarCollector) { $Collector = new Collector(); $Collector->user_id = $id; $Collector->urbanism_id = $urb; $Collector->save(); } } if ($rol == 6) { if ($BuscarCollector) { $cobrador = Collector::findOrFail($BuscarCollector->id); $cobrador->delete(['id']); } } //$permisos->role_id = $rol; //$permisos->save(); } return Response::json(array("estado" => 1)); }
public function record_index() { $user_id = Auth::user()->id; $colonia = Session::get("colonia"); $AssigmentRole = Auth::user()->AssigmentRole[0]->role_id; $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); $urb_name = $urbanism->Colony->name; $collector = Collector::where('user_id', '=', $user_id)->where('urbanism_id', '=', $urbanism->id)->first(); $collector_neighbor = Neighbors::where('user_id', '=', $user_id)->first(); $collector_properties = NeighborProperty::where('neighbors_id', '=', $collector_neighbor->id)->pluck('id'); $neighbors_payments = Payment::join('neighbors_properties', 'payments.neighbor_property_id', '=', 'neighbors_properties.id')->join('neighbors', 'neighbors_properties.neighbors_id', '=', 'neighbors.id')->join('sub_accounts', 'payments.sub_account_id', '=', 'sub_accounts.id')->select('payments.id', 'payments.created_at', 'payments.amount', 'payments.coments', 'neighbors.name', 'neighbors.last_name', 'sub_accounts.description')->where('neighbors_properties.urbanism_id', '=', $urbanism->id)->orderBy('created_at')->get(); $breadcrumbs = Neighbors::with('NeighborProperty')->where('user_id', '=', $user_id)->first(); $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [" . $urb_name . "]"; return View::make('dashboard.incomes.record.index', ['incomes' => $neighbors_payments, 'breadcrumbs_data' => $breadcrumbs_data, 'AssigmentRole' => $AssigmentRole, 'total' => 0]); }
public function __construct() { $this->settings = Collector::get('calculatorsSettings')['deposit']; $this->setPercent($this->settings['percent']); $this->setPercentMilitary($this->settings['percent_military']); $this->setDepositIds(Tree::getDepositsCompared()); }
/** * creates collector which groups the elements according to given classifier * * @api * @param callable $classifier function to map elements to keys * @param \stubbles\sequence\Collector $base optional defaults to Collector::forList() * @return array */ public function inGroups(callable $classifier, Collector $base = null) : array { $collector = null === $base ? Collector::forList() : $base; return $this->with(function () { return []; }, function (&$groups, $element) use($classifier, $collector) { $key = $classifier($element); if (!isset($groups[$key])) { $groups[$key] = $collector->fork(); } $groups[$key]->accumulate($element, $key); }, function ($groups) { foreach ($groups as $key => $group) { $groups[$key] = $group->finish(); } return $groups; }); }
/** * collects all elements into a structure defined by given collector * * This is a terminal operation. * * In case no collector is provided an instance of \stubbles\sequence\Collectors * will be returned which provides convenience methods for some common * collection operations. * * @param \stubbles\sequence\Collector $collector optional * @return mixed|\stubbles\sequence\Collectors */ public function collect(Collector $collector = null) { if (null === $collector) { return new Collectors($this); } foreach ($this->elements as $key => $element) { $collector->accumulate($element, $key); } return $collector->finish(); }
public function showTransfer() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { $blocks = $subTree->children; } return View::make('private-persons.transfers.single', compact('page', 'blocks')); }