Creates a word element with the given data as attributes.

@param string $role
@param string $text

@return Word
512514
public static function factory(string $role, string $text): Word
    {
        $instance = new static();
        $instance->role = $role;
        $instance->text = $text;

        return $instance;
    }
165404
public function createWithRoles(array $data, $roles)
    {
        $user = $this->create((array) $data);

        if (! empty($roles)) {
            $user->roles()->attach($roles);
        }

        return $user;
    }
265415
public function addRole(string $role): GroupInterface
    {
        if (!$this->hasRole($role)) {
            $this->roles[] = mb_strtoupper($role);
        }

        return $this;
    }
1060804
public function setRole($name, $description = null)
    {
        $role = $this->getRole($name) ?: $this->createRole($name);
        if ($description) {
            $role->description = $description;
        }
        $this->add($role);

        return $role;
    }
248464
private function setRoleLanguage($role, $locale, $text)
    {
        if (is_numeric($role)) {
            $role = $this->find($role);
        }

        if (!$role) {
            return;
        }

        $roleName = $role->snake_case_name;
        $languageFilePath = resource_path('lang/' . $locale . '/role.php');
        if (!file_exists($languageFilePath)) {
            throw new FileNotFoundException("resources/lang/{$locale}/role.php doesn't exist.");
        }
        $languageContent = file_get_contents($languageFilePath);

        $text = addslashes($text);
        $regexp = "/('roles'.*=>[\w\W]*)('{$roleName}'\s*=>\s*')(.+)'/";
        $replaceExp = "$1$2{$text}'";

        $languageContent = preg_replace($regexp, $replaceExp, $languageContent);

        file_put_contents($languageFilePath, $languageContent);
    }
639547
public function getRole($role) {
		
		if(false === is_string($role)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR);
		}

		foreach($this -> permissions as $type => $resources) {

			if($role === $type) {
				
				$p = new Resources();
				$p -> setResources($resources);

				return $p;
			}
		}

		return null;
	}
416935
public function makeRoleLockAware($role)
    {
        $role = $this->convertRoleToObject($role);
        $lock = $this->role($role);

        $role->setLock($lock);

        return $role;
    }
1281147
public function addRole($role)
    {
        $role = strtoupper($role);
        if (static::ROLE_DEFAULT === $role) {
            return $this;
        }

        if (!$this->hasRole($role)) {
            $this->roles[] = $role;
        }

        return $this;
    }
1294241
static function create( $roleName, $version = 0 )
    {
        $row = array( 'id' => null,
                      'name' => $roleName,
                      'version' => 0 );
        $role = new eZRole( $row );
        return $role;
    }
778366
protected function createRole($roleName)
    {
        // No need to check is_null($role) as create() throwsException
        $role = $this->roleRepository->create($roleName);

        $this->info('Role created successfully');

        return $role;
    }
1221673
public function addRole($role)
    {
        if (!$this->hasRole($role)) {
            $this->roles[] = strtoupper($role);
        }

        return $this;
    }
422444
public function associate(string $role, string $permission, string $rule = AllowRule::class): PermissionManager
    {
        if (!$this->hasRole($role)) {
            throw new RoleException("Undefined role '{$role}'");
        }

        if (!$this->rules->has($rule)) {
            throw new PermissionException("Undefined rule '{$rule}'");
        }

        $this->permissions[$role][$permission] = $rule;

        return $this;
    }
121315
public function addRole(\Amulen\UserBundle\Entity\Role $role)
    {
        $this->roles[] = $role;

        return $this;
    }
604585
public function buildDomainRoleObject(SPIRole $role)
    {
        $rolePolicies = array();
        foreach ($role->policies as $spiPolicy) {
            $rolePolicies[] = $this->buildDomainPolicyObject($spiPolicy);
        }

        return new Role(
            array(
                'id' => $role->id,
                'identifier' => $role->identifier,
                'status' => $role->status,
                'policies' => $rolePolicies,
            )
        );
    }
742253
private function createCaption(string $text, string $name): Markup
    {
        return HtmlTag::createElement('small')
            ->set('id', $name . '_caption')
            ->text($text);
    }
51159
public function sentence(string $text = null): Sentence
    {
        $sentence = Sentence::factory();
        if ($text !== null) {
            $sentence->text($text);
        }

        /** @var ContainerElement $this */
        return $this->addElement($sentence);
    }
132487
public function paragraph(string $text = null): Paragraph
    {
        $paragraph = Paragraph::factory();
        if ($text !== null) {
            $paragraph->text($text);
        }

        /** @var ContainerElement $this */
        return $this->addElement($paragraph);
    }