Permission/PermissionUtils.php
public static function getSubjectAndField($subject, $optional = false)
    {
        if ($subject instanceof FieldVote) {
            $field = $subject->getField();
            $subject = $subject->getSubject();
        } else {
            if (null === $subject && !$optional) {
                throw new UnexpectedTypeException($subject, 'FieldVote|SubjectIdentityInterface|object|string');
            }

            $field = null;
            $subject = null !== $subject
                ? SubjectUtils::getSubjectIdentity($subject)
                : null;
        }

        return [$subject, $field];
    }
public static function getSubjectAndField($subject, $optional = false)
    {
        if ($subject instanceof FieldVote) {
            $field = $subject->getField();
            $subject = $subject->getSubject();
        } else {
            if (null === $subject && !$optional) {
                throw new UnexpectedTypeException($subject, 'FieldVote|SubjectIdentityInterface|object|string');
            }

            $field = null;
            $subject = null !== $subject
                ? SubjectUtils::getSubjectIdentity($subject)
                : null;
        }

        return [$subject, $field];
    }
public static function getSubjectAndField ( $ subject , $ optional = false ) { if ( $ subject instanceof FieldVote ) { $ field = $ subject -> getField ( ) ; $ subject = $ subject -> getSubject ( ) ; } else { if ( null === $ subject && ! $ optional ) { throw new UnexpectedTypeException ( $ subject , 'FieldVote|SubjectIdentityInterface|object|string' ) ; } $ field = null ; $ subject = null !== $ subject ? SubjectUtils :: getSubjectIdentity ( $ subject ) : null ; } return [ $ subject , $ field ] ; }
Get the subject identity and field.

@param null|FieldVote|object|string|SubjectIdentityInterface $subject  The subject instance or classname
@param bool                                                  $optional Check if the subject id optional

@return array
Get the subject identity and field .