data = $avatar; parent::__construct(); } /** * Initializes the object * * @return void */ protected function init() { if ( empty( $this->fields ) ) { $this->fields = [ 'size' => function () { return ! empty( $this->data['size'] ) ? absint( $this->data['size'] ) : null; }, 'height' => function () { return ! empty( $this->data['height'] ) ? absint( $this->data['height'] ) : null; }, 'width' => function () { return ! empty( $this->data['width'] ) ? absint( $this->data['width'] ) : null; }, 'default' => function () { return ! empty( $this->data['default'] ) ? $this->data['default'] : null; }, 'forceDefault' => function () { return ( ! empty( $this->data['force_default'] ) && true === $this->data['force_default'] ) ? true : false; }, 'rating' => function () { return ! empty( $this->data['rating'] ) ? $this->data['rating'] : null; }, 'scheme' => function () { return ! empty( $this->data['scheme'] ) ? $this->data['scheme'] : null; }, 'extraAttr' => function () { return ! empty( $this->data['extra_attr'] ) ? $this->data['extra_attr'] : null; }, 'foundAvatar' => function () { return ! empty( $this->data['found_avatar'] && true === $this->data['found_avatar'] ) ? true : false; }, 'url' => function () { return ! empty( $this->data['url'] ) ? $this->data['url'] : null; }, ]; } } }