Optimizes the given css content.

@access public
@param array $accessLevels
@param \Zepi\Web\AccessControl\Entity\User $editedGroup
@param \Zepi\Web\AccessControl\Entity\Group $editedGroup
@return string
513671
public function transformAccessLevels($accessLevels, User $user, Group $editedGroup = null)
    {
        $selectorItems = array();
        
        foreach ($accessLevels as $accessLevel) {
            $disabled = false;
            if (!$user->hasAccess($accessLevel->getKey()) || ($editedGroup !== null && $this->isEditedGroup($accessLevel->getKey(), $editedGroup))) {
                $disabled = true;
            }
            
            $name = $accessLevel->getName();
            $description = $accessLevel->getDescription();
            
            if ($accessLevel instanceof GroupAccessLevel) {
                $icon = 'mdi mdi-group';
            } else {
                $icon = 'mdi mdi-toll';

                $name = $this->translationManager->translate($name, $accessLevel->getNamespace());
                $description = $this->translationManager->translate($description, $accessLevel->getNamespace());
            }

            $selectorItems[] = new SelectorItem(
                $accessLevel->getKey(),
                $name,
                $description,
                $icon,
                $disabled
            );
        }
        
        return $selectorItems;
    }
300478
protected function CanEdit(Membergroup $group)
    {
        return self::Guard()->Allow(BackendAction::Edit(), $group) && 
                self::Guard()->Allow(BackendAction::UseIt(), new MembergroupForm());
    }
1131801
public function render_preferences_group(preferences_group $renderable) {
        $html = '';
        $html .= html_writer::start_tag('div', array('class' => 'col-sm-4 preferences-group'));
        $html .= $this->heading($renderable->title, 3);
        $html .= html_writer::start_tag('ul');
        foreach ($renderable->nodes as $node) {
            if ($node->has_children()) {
                debugging('Preferences nodes do not support children', DEBUG_DEVELOPER);
            }
            $html .= html_writer::tag('li', $this->render($node));
        }
        $html .= html_writer::end_tag('ul');
        $html .= html_writer::end_tag('div');
        return $html;
    }
502148
function getAccessType()
    {
        if (!$this->_c__accMode instanceof AccessMode)
            $this->_c__accMode = new AccessMode;

        $this->assertMetaData();
        $mode = $this->getMetaKey('mode');
        if ($mode !== null)
            $this->_c__accMode->fromString($mode);

        return $this->_c__accMode;
    }
160957
public function Render ($indent = 0) {
		$currentGroupRecords = & $this->_getLinksGroupContainer($this->actualGroupName);
		if (count($currentGroupRecords) === 0) return '';
		$minify = (bool)self::$globalOptions['cssMinify'];
		$joinTogether = (bool)self::$globalOptions['cssJoin'];
		if ($joinTogether) {
			$result = $this->_renderItemsTogether(
				$this->actualGroupName,
				$currentGroupRecords,
				$indent,
				$minify
			);
		} else {
			$result = $this->_renderItemsSeparated(
				$this->actualGroupName,
				$currentGroupRecords,
				$indent,
				$minify
			);
		}
		return $result;
	}
67064
public function ofOneOfTheseAccessLevels($accessLevels)
    {
        $items = [];

        foreach ($this->items as $path => $slug) {
            $page = $this->pages->get($path);

            if ($page !== null && isset($page->header()->access)) {
                if (\is_array($page->header()->access)) {
                    //Multiple values for access
                    $valid = false;

                    foreach ($page->header()->access as $index => $accessLevel) {
                        if (\is_array($accessLevel)) {
                            foreach ($accessLevel as $innerIndex => $innerAccessLevel) {
                                if (\in_array($innerAccessLevel, $accessLevels)) {
                                    $valid = true;
                                }
                            }
                        } else {
                            if (\in_array($index, $accessLevels)) {
                                $valid = true;
                            }
                        }
                    }
                    if ($valid) {
                        $items[$path] = $slug;
                    }
                } else {
                    //Single value for access
                    if (\in_array($page->header()->access, $accessLevels)) {
                        $items[$path] = $slug;
                    }
                }

            }
        }

        $this->items = $items;

        return $this;
    }
47540
public function onAdministrationToolOpen(OpenAdministrationToolEvent $event)
    {
        $templatesTool = $this->toolManager->getAdminToolByName('templates_management');

        if (is_null($templatesTool) || !$this->authorization->isGranted('OPEN', $templatesTool)) {
            throw new AccessDeniedException();
        }
        $parameters = $this->parametersSerializer->serialize([Options::SERIALIZE_MINIMAL]);
        $content = $this->templating->render(
            'ClarolineCoreBundle:administration:templates.html.twig', [
                'locales' => isset($parameters['locales']['available']) ? $parameters['locales']['available'] : [],
                'defaultLocale' => isset($parameters['locales']['default']) ? $parameters['locales']['default'] : null,
            ]
        );
        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
757031
public function render(int $indentLevel = 0): string
    {
        $result = '';

        if (!$this->docComment->isEmpty()) {
            $result .= $this->docComment->render($indentLevel) . "\n";
        }

        //Class header
        $header = "class {$this->getName()}";

        //Rendering extends
        if (!empty($this->extends)) {
            $header .= " extends {$this->extends}";
        }

        if (!empty($this->interfaces)) {
            $interfaces = join(", ", array_keys($this->interfaces));
            $header .= " implements {$interfaces}";
        }

        $result .= $this->addIndent($header, $indentLevel) . "\n";
        $result .= $this->addIndent("{", $indentLevel) . "\n";

        //Rendering class body
        $result .= $this->renderBody($indentLevel);

        $result = rtrim($result, "\n") . "\n";
        $result .= $this->addIndent("}", $indentLevel);

        return $result;
    }
1291291
private function mountIndents(string $serialized, int $indentLevel): string
    {
        $lines = explode("\n", $serialized);
        foreach ($lines as &$line) {
            $line = $this->addIndent($line, $indentLevel);
            unset($line);
        }

        return ltrim(join("\n", $lines));
    }
111634
protected function hasGroupLoop($accessLevel, $modifiedUuid)
    {
        $parts = explode('\\', $accessLevel);
        
        if (count($parts) < 3 || $parts[1] !== 'Group') {
            return false;
        }
        
        if ($parts[2] === $modifiedUuid) {
            return true;
        }
        
        if ($this->hasPermissionForModifiedGroup($modifiedUuid, $parts[2])) {
            return true;
        }
        
        return false;
    }
1295786
public function teamsFillAction(Request $request)
    {
        $teams = parent::decodeIdsString($request, 'Claroline\TeamBundle\Entity\Team');
        $workspace = 0 < count($teams) ? $teams[0]->getWorkspace() : null;

        if ($workspace) {
            foreach ($teams as $team) {
                if ($workspace->getId() !== $team->getWorkspace()->getId()) {
                    throw new AccessDeniedException();
                }
            }
        } else {
            throw new AccessDeniedException();
        }
        $this->checkToolAccess($workspace, 'edit');
        $this->teamManager->fillTeams($workspace, $teams);

        return new JsonResponse(null, 204);
    }
403857
public function addOptionalSourceAccessConditionHeader(
        array $headers,
        AccessCondition $accessCondition
    ) {
        if (!is_null($accessCondition)) {
            $header = $accessCondition->getHeader();
            $headerName = null;
            if (!empty($header)) {
                switch ($header) {
                case Resources::IF_MATCH:
                    $headerName = Resources::X_MS_SOURCE_IF_MATCH;
                    break;

                case Resources::IF_UNMODIFIED_SINCE:
                    $headerName = Resources::X_MS_SOURCE_IF_UNMODIFIED_SINCE;
                    break;

                case Resources::IF_MODIFIED_SINCE:
                    $headerName = Resources::X_MS_SOURCE_IF_MODIFIED_SINCE;
                    break;

                case Resources::IF_NONE_MATCH:
                    $headerName = Resources::X_MS_SOURCE_IF_NONE_MATCH;
                    break;

                default:
                    throw new \Exception(Resources::INVALID_ACH_MSG);
                    break;
                }
            }
            $value = $accessCondition->getValue();
            if ($value instanceof \DateTime) {
                $value = gmdate(
                    Resources::AZURE_DATE_FORMAT,
                    $value->getTimestamp()
                );
            }

            $this->addOptionalHeader($headers, $headerName, $value);
        }

        return $headers;
    }
583530
public function allowHeaders(array $excepted)
    {
        if (count($excepted) == 0) {
            throw new AccessControlException('Parameter is empty.', E_USER_ERROR);
        }

        return $this->push('Access-Control-Allow-Headers', implode(', ', $excepted));
    }
777228
public function workspaceEditAction(Workspace $workspace)
    {
        if (!$this->authorization->isGranted('parameters', $workspace)) {
            throw new AccessDeniedException();
        }

        $wsRegisteredName = $workspace->getName();
        $wsRegisteredDisplayable = $workspace->isDisplayable();
        $workspaceAdminTool = $this->toolManager->getAdminToolByName('workspace_management');
        $isAdmin = $this->authorization->isGranted('OPEN', $workspaceAdminTool);
        $expDate = is_null($workspace->getCreationDate()) ? null : $this->utilities->intlDateFormat(
            $workspace->getEndDate()
        );
        $form = $this->formFactory->create(
            FormFactory::TYPE_WORKSPACE_EDIT,
            array(null, null, null, null, null, $isAdmin, $expDate),
            $workspace
        );
        $form->handleRequest($this->request);

        if ($form->isValid()) {
            $this->workspaceManager->editWorkspace($workspace);
            $this->workspaceManager->rename($workspace, $workspace->getName());
            $displayable = $workspace->isDisplayable();

            if (!$displayable && $displayable !== $wsRegisteredDisplayable) {
                $this->workspaceTagManager->deleteAllAdminRelationsFromWorkspace($workspace);
            }

            return $this->redirect(
                $this->generateUrl(
                    'claro_workspace_open_tool',
                    array(
                        'workspaceId' => $workspace->getId(),
                        'toolName' => 'parameters'
                    )
                )
            );
        } else {
            $workspace->setName($wsRegisteredName);
        }

        $user = $this->tokenStorage->getToken()->getUser();

        if ($workspace->getSelfRegistration()) {
            $url = $this->router->generate(
                'claro_workspace_subscription_url_generate',
                array('workspace' => $workspace->getId()),
                true
            );
        } else {
            $url = '';
        }

        return array(
            'form' => $form->createView(),
            'workspace' => $workspace,
            'url' => $url,
            'user' => $user
        );
    }
656014
public function allowOrigin(array $excepted)
    {
        if (!is_array($excepted)) {
            throw new AccessControlException(
                'Attend un tableau.' . gettype($excepted) . ' donner.',
                E_USER_ERROR
            );
        }

        return $this->push(
            'Access-Control-Allow-Origin',
            implode(', ', $excepted)
        );
    }
142318
public function revokePermission($accessEntityUuid, $accessEntityClass, $accessLevel)
    {
        return $this->permissionsDataSource->revokePermission($accessEntityUuid, $accessEntityClass, $accessLevel);
    }
705284
public function indexAction()
    {
        $user = $this->getUser();

        if (!$user) {
            throw new AccessDeniedException();
        }

        $orders = $this->getOrderManager()->findForUser($user, ['createdAt' => 'DESC']);

        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('order_index_title', [], 'SonataOrderBundle'));

        return $this->render('SonataOrderBundle:Order:index.html.twig', [
            'orders' => $orders,
            'breadcrumb_context' => 'user_order',
        ]);
    }