<commit_before><?php

/**
 * Posts
 *
 * @package GrottoPress\Jentil\Utilities\Page
 * @since 0.1.0
 *
 * @author GrottoPress (https://www.grottopress.com)
 * @author <NAME> (https://twitter.com/akadusei)
 */

declare ( strict_types = 1 );

namespace GrottoPress\Jentil\Utilities\Page;

if ( ! \defined( 'WPINC' ) ) {
    die;
}

/**
 * Posts
 * 
 * @since 0.1.0
 */
final class Posts {
    /**
     * Page
     *
     * @since 0.1.0
     * @access private
     * 
     * @var GrottoPress\Jentil\Utilities\Page\Page $page Page.
     */
    private $page;

    /**
     * Sticky posts enabled?
     *
     * @since 0.1.0
     * @access private
     * 
     * @var boolean $sticky_enabled Is sticky posts enabled?
     */
    private $sticky_enabled;

    /**
     * Sticky posts
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $sticky_posts Sticky posts IDs.
     */
    private $sticky_posts;

    /**
     * Post types
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $post_types Post type objects.
     */
    private $post_types;

    /**
     * Archive Post types
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $archive_post_types All post types with archive.
     */
    private $archive_post_types;
    
    /**
     * Constructor
     *
     * @var GrottoPress\Jentil\Utilities\Page\Page $page Page.
     *
     * @since 0.1.0
     * @access public
     */
    public function __construct( Page $page ) {
        $this->page = $page;

        $this->sticky_posts = $this->sticky_posts();
        $this->post_types = $this->post_types();
        $this->archive_post_types = $this->archive_post_types();
    }

    /**
     * Get Posts
     * 
     * @since 0.1.0
     * @access public
     * 
     * @return string Posts.
     */
    public function get(): string {
        $out = '';

        if (
            ! $this->page->is( 'singular' )
            && ! $this->page->is( 'paged' )
            && ( $this->sticky_enabled = $this->sticky_enabled() )
            && $this->sticky_posts
        ) {
            $out .= $this->page->utilities()->posts( $this->sticky_args() )->run();
        }

        $out .= $this->page->utilities()->posts( $this->args() )->run();

        return $out;
    }

    /**
     * Get sticky posts
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Sticky posts
     */
    private function sticky_posts(): array {
        return \array_map( 'absint', \get_option( 'sticky_posts' ) );
    }

    /**
     * Post types
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Post types
     */
    private function post_types(): array {
        return \get_post_types( [ 'public' => true ], 'objects' );
    }

    /**
     * Archive Post types
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array All post types with archive.
     */
    private function archive_post_types(): array {
        $archive_post_types = [];

        if ( ! $this->post_types ) {
            return $archive_post_types;
        }

        foreach ( $this->post_types as $post_type ) {
            if ( $post_type->has_archive || 'post' == $post_type->name ) {
                $archive_post_types[] = $post_type->name;
            }
        }

        return $archive_post_types;
    }

    /**
     * Sticky posts enabled?
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return bool Do we have sticky posts enabled?
     */
    private function sticky_enabled(): int {
        return $this->mod( 'sticky_posts' );
    }

    /**
     * Get Posts Query Args
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Posts args.
     */
    private function args(): array {
        if ( $this->page->is( 'singular' ) ) {
            return $this->singular_args();
        }
<commit_msg>fixed return type error in page posts utility<commit_after><?php

/**
 * Posts
 *
 * @package GrottoPress\Jentil\Utilities\Page
 * @since 0.1.0
 *
 * @author GrottoPress (https://www.grottopress.com)
 * @author <NAME> (https://twitter.com/akadusei)
 */

declare ( strict_types = 1 );

namespace GrottoPress\Jentil\Utilities\Page;

if ( ! \defined( 'WPINC' ) ) {
    die;
}

/**
 * Posts
 * 
 * @since 0.1.0
 */
final class Posts {
    /**
     * Page
     *
     * @since 0.1.0
     * @access private
     * 
     * @var GrottoPress\Jentil\Utilities\Page\Page $page Page.
     */
    private $page;

    /**
     * Sticky posts enabled?
     *
     * @since 0.1.0
     * @access private
     * 
     * @var boolean $sticky_enabled Is sticky posts enabled?
     */
    private $sticky_enabled;

    /**
     * Sticky posts
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $sticky_posts Sticky posts IDs.
     */
    private $sticky_posts;

    /**
     * Post types
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $post_types Post type objects.
     */
    private $post_types;

    /**
     * Archive Post types
     *
     * @since 0.1.0
     * @access private
     * 
     * @var array $archive_post_types All post types with archive.
     */
    private $archive_post_types;
    
    /**
     * Constructor
     *
     * @var GrottoPress\Jentil\Utilities\Page\Page $page Page.
     *
     * @since 0.1.0
     * @access public
     */
    public function __construct( Page $page ) {
        $this->page = $page;

        $this->sticky_posts = $this->sticky_posts();
        $this->post_types = $this->post_types();
        $this->archive_post_types = $this->archive_post_types();
    }

    /**
     * Get Posts
     * 
     * @since 0.1.0
     * @access public
     * 
     * @return string Posts.
     */
    public function get(): string {
        $out = '';

        if (
            ! $this->page->is( 'singular' )
            && ! $this->page->is( 'paged' )
            && ( $this->sticky_enabled = $this->sticky_enabled() )
            && $this->sticky_posts
        ) {
            $out .= $this->page->utilities()->posts( $this->sticky_args() )->run();
        }

        $out .= $this->page->utilities()->posts( $this->args() )->run();

        return $out;
    }

    /**
     * Get sticky posts
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Sticky posts
     */
    private function sticky_posts(): array {
        return \array_map( 'absint', \get_option( 'sticky_posts' ) );
    }

    /**
     * Post types
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Post types
     */
    private function post_types(): array {
        return \get_post_types( [ 'public' => true ], 'objects' );
    }

    /**
     * Archive Post types
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array All post types with archive.
     */
    private function archive_post_types(): array {
        $archive_post_types = [];

        if ( ! $this->post_types ) {
            return $archive_post_types;
        }

        foreach ( $this->post_types as $post_type ) {
            if ( $post_type->has_archive || 'post' == $post_type->name ) {
                $archive_post_types[] = $post_type->name;
            }
        }

        return $archive_post_types;
    }

    /**
     * Sticky posts enabled?
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return bool Do we have sticky posts enabled?
     */
    private function sticky_enabled(): bool {
        return ( bool ) $this->mod( 'sticky_posts' );
    }

    /**
     * Get Posts Query Args
     * 
     * @since 0.1.0
     * @access private
     * 
     * @return array Posts args.
     */
    private function args(): array {
        if ( $this->page->is( 'singular' ) ) {
            return $this->singular_args();
        }

{'fraction_non_alphanumeric': 0.14573248407643313, 'fraction_numerical': 0.010955414012738853, 'mean_word_length': 1.6532612369043596, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 73, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3614268', 'n_tokens_mistral': 2685, 'n_tokens_neox': 2556, 'n_words': 548}