original_string: protected function validatePermissionsUserRole()
      {
          $field = 'permissions';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          if (empty($value)) {
              $this->setSubmitted($field, array());
              return null;
          }
  
          if (!is_array($value)) {
              $this->setErrorInvalid($field, $this->translation->text('Permissions'));
              return false;
          }
  
          $permissions = $this->role->getPermissions();
          $invalid = array_diff($value, array_keys($permissions));
  
          if (!empty($invalid)) {
              $this->setErrorUnavailable($field, implode(',', $invalid));
              return false;
          }
  
          return true;
      }
code: protected function validatePermissionsUserRole()
      {
          $field = 'permissions';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          if (empty($value)) {
              $this->setSubmitted($field, array());
              return null;
          }
  
          if (!is_array($value)) {
              $this->setErrorInvalid($field, $this->translation->text('Permissions'));
              return false;
          }
  
          $permissions = $this->role->getPermissions();
          $invalid = array_diff($value, array_keys($permissions));
  
          if (!empty($invalid)) {
              $this->setErrorUnavailable($field, implode(',', $invalid));
              return false;
          }
  
          return true;
      }
code_tokens: protected function validatePermissionsUserRole ( ) { $ field = 'permissions' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } if ( empty ( $ value ) ) { $ this -> setSubmitted ( $ field , array ( ) ) ; return null ; } if ( ! is_array ( $ value ) ) { $ this -> setErrorInvalid ( $ field , $ this -> translation -> text ( 'Permissions' ) ) ; return false ; } $ permissions = $ this -> role -> getPermissions ( ) ; $ invalid = array_diff ( $ value , array_keys ( $ permissions ) ) ; if ( ! empty ( $ invalid ) ) { $ this -> setErrorUnavailable ( $ field , implode ( ',' , $ invalid ) ) ; return false ; } return true ; }
docstring: Validates permissions data
  @return boolean|null
docstring_tokens: Validates permissions data