concrete/src/Error/ErrorList/Formatter/JsonFormatter.php
public function asArray()
    {
        $error = $this->error;
        if ($error->has()) {
            $o = [
                'error' => true,
                'errors' => [],
                'htmlErrorIndexes' => [],
            ];
            $index = 0;
            foreach ($error->getList() as $error) {
                $o['errors'][] = (string) $error;
                if ($error instanceof HtmlAwareErrorInterface && $error->messageContainsHtml()) {
                    $o['htmlErrorIndexes'][] = $index;
                }
                ++$index;
            }
            if (empty($o['htmlErrorIndexes'])) {
                unset($o['htmlErrorIndexes']);
            }

            return $o;
        }
    }
public function asArray()
    {
        $error = $this->error;
        if ($error->has()) {
            $o = [
                'error' => true,
                'errors' => [],
                'htmlErrorIndexes' => [],
            ];
            $index = 0;
            foreach ($error->getList() as $error) {
                $o['errors'][] = (string) $error;
                if ($error instanceof HtmlAwareErrorInterface && $error->messageContainsHtml()) {
                    $o['htmlErrorIndexes'][] = $index;
                }
                ++$index;
            }
            if (empty($o['htmlErrorIndexes'])) {
                unset($o['htmlErrorIndexes']);
            }

            return $o;
        }
    }
public function asArray ( ) { $ error = $ this -> error ; if ( $ error -> has ( ) ) { $ o = [ 'error' => true , 'errors' => [ ] , 'htmlErrorIndexes' => [ ] , ] ; $ index = 0 ; foreach ( $ error -> getList ( ) as $ error ) { $ o [ 'errors' ] [ ] = ( string ) $ error ; if ( $ error instanceof HtmlAwareErrorInterface && $ error -> messageContainsHtml ( ) ) { $ o [ 'htmlErrorIndexes' ] [ ] = $ index ; } ++ $ index ; } if ( empty ( $ o [ 'htmlErrorIndexes' ] ) ) { unset ( $ o [ 'htmlErrorIndexes' ] ) ; } return $ o ; } }
Build an array describing the errors.

@return array|null return NULL if the error list is empty, an array otherwise
Build an array describing the errors .