src/Schema/Validator.php
public static function getOptionalErrors(array $data, array $errors = [])
    {
        //validations

        if (isset($data['singular']) && strlen($data['singular']) <= 2) {
            $errors['singular'] = 'Singular should be longer than 2 characters';
        }

        if (isset($data['singular']) && strlen($data['singular']) >= 255) {
            $errors['singular'] = 'Singular should be less than 255 characters';
        }

        if (isset($data['plural']) && strlen($data['plural']) <= 2) {
            $errors['plural'] = 'Plural should be longer than 2 characters';
        }

        if (isset($data['plural']) && strlen($data['plural']) >= 255) {
            $errors['plural'] = 'Plural should be less than 255 characters';
        }

        if (isset($data['name']) && !preg_match('#^[a-zA-Z0-9\-_]+$#', $data['name'])) {
            $errors['name'] = 'Keyword must only have letters, numbers, dashes';
        }

        if (isset($data['relations'])) {
            $relations = [];
            foreach ($data['relations'] as $i => $relation) {
                if (in_array($relation['name'], $relations)) {
                    $errors['relations'] = 'Duplicate Relations';
                    break;
                }

                if (!trim($relation['name'])) {
                    $errors['relations'] = 'Empty relation name';
                    break;
                }

                $relations[] = $relation['name'];
            }
        }

        return $errors;
    }
public static function getOptionalErrors(array $data, array $errors = [])
    {
        //validations

        if (isset($data['singular']) && strlen($data['singular']) <= 2) {
            $errors['singular'] = 'Singular should be longer than 2 characters';
        }

        if (isset($data['singular']) && strlen($data['singular']) >= 255) {
            $errors['singular'] = 'Singular should be less than 255 characters';
        }

        if (isset($data['plural']) && strlen($data['plural']) <= 2) {
            $errors['plural'] = 'Plural should be longer than 2 characters';
        }

        if (isset($data['plural']) && strlen($data['plural']) >= 255) {
            $errors['plural'] = 'Plural should be less than 255 characters';
        }

        if (isset($data['name']) && !preg_match('#^[a-zA-Z0-9\-_]+$#', $data['name'])) {
            $errors['name'] = 'Keyword must only have letters, numbers, dashes';
        }

        if (isset($data['relations'])) {
            $relations = [];
            foreach ($data['relations'] as $i => $relation) {
                if (in_array($relation['name'], $relations)) {
                    $errors['relations'] = 'Duplicate Relations';
                    break;
                }

                if (!trim($relation['name'])) {
                    $errors['relations'] = 'Empty relation name';
                    break;
                }

                $relations[] = $relation['name'];
            }
        }

        return $errors;
    }
public static function getOptionalErrors ( array $ data , array $ errors = [ ] ) { //validations if ( isset ( $ data [ 'singular' ] ) && strlen ( $ data [ 'singular' ] ) <= 2 ) { $ errors [ 'singular' ] = 'Singular should be longer than 2 characters' ; } if ( isset ( $ data [ 'singular' ] ) && strlen ( $ data [ 'singular' ] ) >= 255 ) { $ errors [ 'singular' ] = 'Singular should be less than 255 characters' ; } if ( isset ( $ data [ 'plural' ] ) && strlen ( $ data [ 'plural' ] ) <= 2 ) { $ errors [ 'plural' ] = 'Plural should be longer than 2 characters' ; } if ( isset ( $ data [ 'plural' ] ) && strlen ( $ data [ 'plural' ] ) >= 255 ) { $ errors [ 'plural' ] = 'Plural should be less than 255 characters' ; } if ( isset ( $ data [ 'name' ] ) && ! preg_match ( '#^[a-zA-Z0-9\-_]+$#' , $ data [ 'name' ] ) ) { $ errors [ 'name' ] = 'Keyword must only have letters, numbers, dashes' ; } if ( isset ( $ data [ 'relations' ] ) ) { $ relations = [ ] ; foreach ( $ data [ 'relations' ] as $ i => $ relation ) { if ( in_array ( $ relation [ 'name' ] , $ relations ) ) { $ errors [ 'relations' ] = 'Duplicate Relations' ; break ; } if ( ! trim ( $ relation [ 'name' ] ) ) { $ errors [ 'relations' ] = 'Empty relation name' ; break ; } $ relations [ ] = $ relation [ 'name' ] ; } } return $ errors ; }
Returns Table Optional Errors

@param *array $data
@param array  $errors

@return array
Returns Table Optional Errors