$25 GRAYBYTE WORDPRESS FILE MANAGER $77

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/TestData/Factories/

HOME
Current File : /home/bravetechrwanda/itiministry.org/plugins/give/src/TestData/Factories//DonationFormFactory.php
<?php

namespace Give\TestData\Factories;

use Give\TestData\Framework\Factory;

/**
 * Class DonationFormFactory
 * @package Give\TestData\Factories
 */
class DonationFormFactory extends Factory
{

    /**
     * @var bool
     */
    private $donationGoal;

    /**
     * @var bool
     */
    private $termsAndConditions;

    /**
     * @var string
     */
    private $template;

    /**
     * @var string[]
     */
    private $templates = ['sequoia', 'legacy'];

    /**
     * @param string $template
     *
     * @return bool
     */
    public function checkFormTemplate($template)
    {
        if ('random' === $template) {
            return true;
        }

        return in_array($template, $this->templates);
    }

    /**
     * @param string $template
     */
    public function setFormTemplate($template)
    {
        $this->template = $template;
    }

    /**
     * @return string
     */
    public function getFormTemplate()
    {
        if ('random' === $this->template) {
            return $this->randomDonationTemplate();
        }

        return $this->template;
    }

    /**
     * @return string
     */
    public function randomDonationTemplate()
    {
        return $this->faker->randomElement($this->templates);
    }

    /**
     * @param bool $generate
     */
    public function setDonationFormGoal($generate)
    {
        $this->donationGoal = (bool)$generate;
    }

    /**
     * @return false|string
     */
    public function getDonationGoal()
    {
        if (is_null($this->donationGoal) || ! $this->donationGoal) {
            return false;
        }

        return $this->randomGoal();
    }

    /**
     * @param bool $generate
     */
    public function setTermsAndConditions($generate)
    {
        $this->termsAndConditions = (bool)$generate;
    }

    /**
     * @return array
     */
    public function getTermsAndConditions()
    {
        if (is_null($this->termsAndConditions) || ! $this->termsAndConditions) {
            return [];
        }

        return [
            'label' => $this->faker->catchPhrase(),
            'text' => $this->faker->text(),
        ];
    }

    /**
     * Donor definition
     *
     * @since 1.0.0
     * @return array
     */
    public function definition()
    {
        $title = $this->faker->catchPhrase();

        return [
            'post_title' => $title,
            'post_name' => sanitize_title($title),
            'post_author' => $this->randomAuthor(),
            'post_date' => date('Y-m-d H:i:s'),
            'donation_goal' => $this->getDonationGoal(),
            'donation_terms' => $this->getTermsAndConditions(),
            'form_template' => $this->getFormTemplate(),
            'random_amount' => $this->randomAmount(),
        ];
    }

}

Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
DonationFactory.php
4.081 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
DonationFormFactory.php
2.721 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
DonorFactory.php
0.579 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
LogFactory.php
1.779 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
PageFactory.php
1.318 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
RevenueFactory.php
0.472 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF