@param string $active
@param string $inactive

@return ElSwitch
970753
public function setTexts(string $active, string $inactive)
    {
        $this->texts = [$active, $inactive];

        return $this;
    }
721696
protected function normalizeItems($items, &$active)
    {
        foreach ($items as $i => $item) {

            if (isset($item['roles'])) {
                $item['visible'] = false;
                foreach ($item['roles'] as $role) {
                    if (Yii::$app->user->can($role)) {
                        $item['visible'] = true;
                        break;
                    }
                }
            }
            if (isset($item['visible']) && !$item['visible']) {
                unset($items[$i]);
                continue;
            }
            if (!isset($item['label'])) {
                $item['label'] = '';
            }
            if ($item['label'] instanceof Closure) {
                $item['label'] = call_user_func($item['label'], $item);
            }

            if (!isset($items[$i]['options'])) {
                $items[$i]['options'] = [];
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            $items[$i]['label'] = $encodeLabel ? Html::encode($item['label']) : $item['label'];
            $hasActiveChild = false;
            if (isset($item['items'])) {
                $items[$i]['items'] = $this->normalizeItems($item['items'], $hasActiveChild);
                if (empty($items[$i]['items']) && $this->hideEmptyItems) {
                    unset($items[$i]['items']);
                    if (!isset($item['url'])) {
                        unset($items[$i]);
                        continue;
                    }
                }
                Html::addCssClass($items[$i]['options'], $this->submenuItemClass);
            }
            if (!isset($item['active'])) {
                if ($this->activateParents && $hasActiveChild || $this->activateItems && $this->isItemActive($item)) {
                    $active = $items[$i]['active'] = true;
                } else {
                    $items[$i]['active'] = false;
                }
            } elseif ($item['active']) {
                $active = true;
            }
        }

        return array_values($items);
    }
985692
protected function switchActive($active, $save = true)
    {
        $this->forceFill(['activated_at' => boolval($active) ? now() : null]);

        return $save ? $this->save() : false;
    }
1082479
protected function isChildActive($items, &$active)
    {
        foreach ($items as $i => $child) {
            if (ArrayHelper::remove($items[$i], 'active', false) || $this->isItemActive($child)) {
                Html::addCssClass($items[$i]['options'], 'active');
                if ($this->activateParents) {
                    $active = true;
                }
            }
            if (isset($child['items']) && is_array($child['items'])) {
                $child['items'] = $this->isChildActive($child['items'], $active);
            }
        }
        return $items;
    }
420283
public function activeForActor($actor)
    {
        $actortype = $actor->getEntityDescription()->getInheritanceColumnValue()->getIdentifier();

        $access = $this->getAssignmentForIdentifier($actortype);

        $return = false;

        if ($access == self::ACCESS_ALWAYS) {
            $return = true;
        } elseif ($access == self::ACCESS_OPTIONAL) {
            $return = $this->enabledForActor($actor);
        }

        return $return;
    }
316689
static function active( $asObject = true, $offset, $limit, $sortField = "created", $sortOrder = "asc", $show = eZOrder::SHOW_NORMAL )
    {
        if ( $sortField == "user_name" )
        {
            $db = eZDB::instance();

            $db_params = array();
            $db_params["offset"] =(int) $offset;
            $db_params["limit"] =(int) $limit;
            $sortOrder = $db->escapeString( $sortOrder );

            $query = "SELECT ezorder.*
                      FROM
                            ezorder,
                            ezcontentobject
                      WHERE
                            ".eZOrder::getShowOrdersQuery( $show, "ezorder" )." AND
                            ezorder.is_temporary = '0' AND
                            ezcontentobject.id = ezorder.user_id
                      ORDER BY ezcontentobject.name $sortOrder";
            $orderArray = $db->arrayQuery( $query, $db_params );
            if ( $asObject )
            {
                $retOrders = array();
                foreach ( $orderArray as $order )
                {
                    $order = new eZOrder( $order );
                    $retOrders[] = $order;
                }
                return $retOrders;
            }
            else
            {
                return $orderArray;
            }
        }
        else
        {
            $where['is_temporary'] = 0;
            if ( $show != eZOrder::SHOW_ALL )
            {
                $where['is_archived'] = $show;
            }

            return eZPersistentObject::fetchObjectList( eZOrder::definition(),
                                                        null,
                                                        $where ,
                                                        array( $sortField => $sortOrder ),
                                                        array( 'offset' => $offset,
                                                               'length' => $limit ), $asObject );
        }
    }
847151
public static function activeCheckboxListSmartToggles($model, $attribute, $items, $options = [])
    {
        $options['itemOptions']['labelOptions'] = ['class' => 'toggle'];
        return static::activeListInput('checkboxListSmart', $model, $attribute, $items, $options);
    }
896567
public function getAddons($active = false) {
        if ($active) {
            return array_keys($this->enabled);
        }
        return array_keys($this->addons);
    }
1347538
public function findByStatus($active=1)
    {
        $result = null;
        try {
            $role = $this->getRepository('\erdiko\users\entities\Role');
            $result = $role->findBy(array('active' => $active));
        } catch (\Exception $e) {
            \error_log($e->getMessage());
        }
        return $result;
    }
1084938
public function isActive($active = true)
    {
        if (! is_bool($active)) {
            $active = false;
        }
        $this->isActive = $active;

        return $this;
    }
1343611
public function getActive()
    {
        if (count($this->active) < 1) {
            return null;
        }
        while (time() > current($this->active)) {
            $key = key($this->active);
            $this->expired[$key] = current($this->active);
            $this->increment($this->active);
            unset($this->active[$key]);
            if (count($this->active) < 1) {
                return null;
            }
        }
        $active = key($this->active);
        $this->increment($this->active);
        return $active;
    }
1274203
public function deactivate($save = true)
    {
        event(new DeactivatingUser($this));
        $result = $this->switchActive(false, $save);
        event(new DeactivatedUser($this));

        return $result;
    }
927967
function set_network_active( $is_network_active = true, $is_delegated_connection = false ) {
            $this->_is_network_active       = $is_network_active;
            $this->_is_delegated_connection = $is_delegated_connection;
        }
872283
public function getActiveSelection()
    {
        if ($this->_oActiveSelection === null) {
            if (($aSelections = $this->getSelections())) {
                // first is allways active
                $this->_oActiveSelection = reset($aSelections);
            }
        }

        return $this->_oActiveSelection;
    }
395423
protected function buildActive(array $active)
    {
        $active[2] = array_merge_recursive(
            $active[2],
            ['class' => 'active']
        );
        $this->buildItem(count($this->stack), $active);
    }
22461
protected final function action_menu($elementname, $exported, $persistent) {

        // Just in case, we are doing funny stuff below.
        $elementname = clean_param($elementname, PARAM_ALPHA);

        // Actions.
        $actionmenu = new \action_menu();
        $actionmenu->set_menu_trigger(get_string('actions'));
        $actionmenu->set_owner_selector($elementname . '-' . $exported->id . '-actions');
        $actionmenu->set_alignment(\action_menu::TL, \action_menu::BL);

        $url = new \moodle_url('/admin/tool/dataprivacy/edit' . $elementname . '.php',
            ['id' => $exported->id]);
        $link = new \action_menu_link_secondary($url, new \pix_icon('t/edit',
            get_string('edit')), get_string('edit'));
        $actionmenu->add($link);

        if (!$persistent->is_used()) {
            $url = new \moodle_url('#');
            $attrs = ['data-id' => $exported->id, 'data-action' => 'delete' . $elementname, 'data-name' => $exported->name];
            $link = new \action_menu_link_secondary($url, new \pix_icon('t/delete',
                get_string('delete')), get_string('delete'), $attrs);
            $actionmenu->add($link);
        }

        return $actionmenu;
    }
1087287
public function block($enabled = null)
    {
        if (is_null($enabled)) {
            $enabled = !$this->isBlock;
        }

        $this->isBlock = $enabled;

        return $this;
    }