[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.21.105.46: ~ $
<?php

namespace MailPoet\Features;

if (!defined('ABSPATH')) exit;


use MailPoet\Doctrine\Repository;
use MailPoet\Entities\FeatureFlagEntity;

/**
 * @extends Repository<FeatureFlagEntity>
 */
class FeatureFlagsRepository extends Repository {
  protected function getEntityClassName() {
    return FeatureFlagEntity::class;
  }

  /**
   * @param array $data
   * @throws \RuntimeException
   * @throws \InvalidArgumentException
   * @return FeatureFlagEntity
   */
  public function createOrUpdate(array $data = []) {
    if (!$data['name']) {
      throw new \InvalidArgumentException('Missing name');
    }
    $featureFlag = $this->findOneBy([
      'name' => $data['name'],
    ]);
    if (!$featureFlag) {
      $featureFlag = new FeatureFlagEntity($data['name']);
      $this->persist($featureFlag);
    }

    if (array_key_exists('value', $data)) {
      $featureFlag->setValue($data['value']);
    }

    try {
      $this->flush();
    } catch (\Exception $e) {
      throw new \RuntimeException("Error when saving feature " . $data['name']);
    }
    return $featureFlag;
  }
}

Filemanager

Name Type Size Permission Actions
FeatureFlagsController.php File 1.34 KB 0644
FeatureFlagsRepository.php File 1.07 KB 0644
FeaturesController.php File 1.86 KB 0644
index.php File 0 B 0644