Add public keyword to methods
[MAILPOET-2413]
This commit is contained in:
@ -11,7 +11,7 @@ class AnnotationReaderProvider {
|
||||
/** @var CachedReader */
|
||||
private $annotation_reader;
|
||||
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
// register annotation reader if doctrine/annotations package is installed
|
||||
// (i.e. in dev environment, on production metadata is dumped in the build)
|
||||
$read_annotations = class_exists(CachedReader::class) && class_exists(AnnotationReader::class);
|
||||
@ -24,7 +24,7 @@ class AnnotationReaderProvider {
|
||||
}
|
||||
|
||||
/** @return CachedReader|null */
|
||||
function getAnnotationReader() {
|
||||
public function getAnnotationReader() {
|
||||
return $this->annotation_reader;
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ class ConfigurationFactory {
|
||||
/** @var AnnotationReaderProvider */
|
||||
private $annotation_reader_provider;
|
||||
|
||||
function __construct($is_dev_mode = null, AnnotationReaderProvider $annotation_reader_provider) {
|
||||
public function __construct($is_dev_mode = null, AnnotationReaderProvider $annotation_reader_provider) {
|
||||
$this->is_dev_mode = $is_dev_mode === null ? WP_DEBUG : $is_dev_mode;
|
||||
$this->annotation_reader_provider = $annotation_reader_provider;
|
||||
}
|
||||
|
||||
function createConfiguration() {
|
||||
public function createConfiguration() {
|
||||
$configuration = new Configuration();
|
||||
$configuration->setNamingStrategy(new UnderscoreNamingStrategy());
|
||||
|
||||
|
@ -21,7 +21,7 @@ class ConnectionFactory {
|
||||
JsonOrSerializedType::NAME => JsonOrSerializedType::class,
|
||||
];
|
||||
|
||||
function createConnection() {
|
||||
public function createConnection() {
|
||||
$platform_class = self::PLATFORM_CLASS;
|
||||
$connection_params = [
|
||||
'wrapperClass' => SerializableConnection::class,
|
||||
|
@ -25,7 +25,7 @@ class EntityManagerFactory {
|
||||
/** @var ValidationListener */
|
||||
private $validation_listener;
|
||||
|
||||
function __construct(
|
||||
public function __construct(
|
||||
Connection $connection,
|
||||
Configuration $configuration,
|
||||
TimestampListener $timestamp_listener,
|
||||
@ -37,7 +37,7 @@ class EntityManagerFactory {
|
||||
$this->validation_listener = $validation_listener;
|
||||
}
|
||||
|
||||
function createEntityManager() {
|
||||
public function createEntityManager() {
|
||||
$entity_manager = EntityManager::create($this->connection, $this->configuration);
|
||||
$this->setupListeners($entity_manager);
|
||||
if (class_exists(Debugger::class)) {
|
||||
|
@ -13,12 +13,12 @@ trait DeletedAtTrait {
|
||||
private $deleted_at;
|
||||
|
||||
/** @return DateTimeInterface|null */
|
||||
function getDeletedAt() {
|
||||
public function getDeletedAt() {
|
||||
return $this->deleted_at;
|
||||
}
|
||||
|
||||
/** @param DateTimeInterface|null $deleted_at */
|
||||
function setDeletedAt($deleted_at) {
|
||||
public function setDeletedAt($deleted_at) {
|
||||
$this->deleted_at = $deleted_at;
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ class TimestampListener {
|
||||
/** @var Carbon */
|
||||
private $now;
|
||||
|
||||
function __construct(WPFunctions $wp) {
|
||||
public function __construct(WPFunctions $wp) {
|
||||
$this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
|
||||
}
|
||||
|
||||
function prePersist(LifecycleEventArgs $event_args) {
|
||||
public function prePersist(LifecycleEventArgs $event_args) {
|
||||
$entity = $event_args->getEntity();
|
||||
$entity_traits = $this->getEntityTraits($entity);
|
||||
|
||||
@ -30,7 +30,7 @@ class TimestampListener {
|
||||
}
|
||||
}
|
||||
|
||||
function preUpdate(LifecycleEventArgs $event_args) {
|
||||
public function preUpdate(LifecycleEventArgs $event_args) {
|
||||
$entity = $event_args->getEntity();
|
||||
$entity_traits = $this->getEntityTraits($entity);
|
||||
|
||||
|
@ -10,11 +10,11 @@ class ValidationListener {
|
||||
/** @var ValidatorInterface */
|
||||
private $validator;
|
||||
|
||||
function __construct(ValidatorInterface $validator) {
|
||||
public function __construct(ValidatorInterface $validator) {
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
function onFlush(OnFlushEventArgs $event_args) {
|
||||
public function onFlush(OnFlushEventArgs $event_args) {
|
||||
$unit_of_work = $event_args->getEntityManager()->getUnitOfWork();
|
||||
|
||||
foreach ($unit_of_work->getScheduledEntityInsertions() as $entity) {
|
||||
|
@ -19,7 +19,7 @@ class MetadataCache extends CacheProvider {
|
||||
/** @var string */
|
||||
private $directory;
|
||||
|
||||
function __construct($dir, $is_read_only) {
|
||||
public function __construct($dir, $is_read_only) {
|
||||
$this->is_dev_mode = defined('WP_DEBUG') && WP_DEBUG && !$is_read_only;
|
||||
$this->directory = rtrim($dir, '/\\');
|
||||
if (!file_exists($this->directory)) {
|
||||
|
@ -17,7 +17,7 @@ abstract class Repository {
|
||||
/** @var DoctrineEntityRepository */
|
||||
protected $doctrine_repository;
|
||||
|
||||
function __construct(EntityManager $entity_manager) {
|
||||
public function __construct(EntityManager $entity_manager) {
|
||||
$this->entity_manager = $entity_manager;
|
||||
$this->class_metadata = $entity_manager->getClassMetadata($this->getEntityClassName());
|
||||
$this->doctrine_repository = new DoctrineEntityRepository($this->entity_manager, $this->class_metadata);
|
||||
@ -30,7 +30,7 @@ abstract class Repository {
|
||||
* @param int|null $offset
|
||||
* @return array
|
||||
*/
|
||||
function findBy(array $criteria, array $order_by = null, $limit = null, $offset = null) {
|
||||
public function findBy(array $criteria, array $order_by = null, $limit = null, $offset = null) {
|
||||
return $this->doctrine_repository->findBy($criteria, $order_by, $limit, $offset);
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ abstract class Repository {
|
||||
* @param array|null $order_by
|
||||
* @return object|null
|
||||
*/
|
||||
function findOneBy(array $criteria, array $order_by = null) {
|
||||
public function findOneBy(array $criteria, array $order_by = null) {
|
||||
return $this->doctrine_repository->findOneBy($criteria, $order_by);
|
||||
}
|
||||
|
||||
@ -47,25 +47,25 @@ abstract class Repository {
|
||||
* @param mixed $id
|
||||
* @return object|null
|
||||
*/
|
||||
function findOneById($id) {
|
||||
public function findOneById($id) {
|
||||
return $this->doctrine_repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function findAll() {
|
||||
public function findAll() {
|
||||
return $this->doctrine_repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $entity
|
||||
*/
|
||||
function persist($entity) {
|
||||
public function persist($entity) {
|
||||
$this->entity_manager->persist($entity);
|
||||
}
|
||||
|
||||
function truncate() {
|
||||
public function truncate() {
|
||||
$cmd = $this->entity_manager->getClassMetadata($this->getEntityClassName());
|
||||
$table_name = $cmd->getTableName();
|
||||
$connection = $this->entity_manager->getConnection();
|
||||
@ -80,11 +80,11 @@ abstract class Repository {
|
||||
/**
|
||||
* @param object $entity
|
||||
*/
|
||||
function remove($entity) {
|
||||
public function remove($entity) {
|
||||
$this->entity_manager->remove($entity);
|
||||
}
|
||||
|
||||
function flush() {
|
||||
public function flush() {
|
||||
$this->entity_manager->flush();
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ class SerializableConnection extends Connection {
|
||||
private $config;
|
||||
private $event_manager;
|
||||
|
||||
function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $event_manager = null) {
|
||||
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $event_manager = null) {
|
||||
$this->params = $params;
|
||||
$this->driver = $driver;
|
||||
$this->config = $config;
|
||||
@ -21,11 +21,11 @@ class SerializableConnection extends Connection {
|
||||
parent::__construct($params, $driver, $config, $event_manager);
|
||||
}
|
||||
|
||||
function __sleep() {
|
||||
public function __sleep() {
|
||||
return ['params', 'driver', 'config', 'event_manager'];
|
||||
}
|
||||
|
||||
function __wakeup() {
|
||||
public function __wakeup() {
|
||||
parent::__construct($this->params, $this->driver, $this->config, $this->event_manager);
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ class TablePrefixMetadataFactory extends ClassMetadataFactory {
|
||||
/** @var array */
|
||||
private $prefixed_map = [];
|
||||
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
if (Env::$db_prefix === null) {
|
||||
throw new \RuntimeException('DB table prefix not initialized');
|
||||
}
|
||||
$this->prefix = Env::$db_prefix;
|
||||
}
|
||||
|
||||
function getMetadataFor($class_name) {
|
||||
public function getMetadataFor($class_name) {
|
||||
$class_metadata = parent::getMetadataFor($class_name);
|
||||
if (isset($this->prefixed_map[$class_metadata->getName()])) {
|
||||
return $class_metadata;
|
||||
@ -40,7 +40,7 @@ class TablePrefixMetadataFactory extends ClassMetadataFactory {
|
||||
return $class_metadata;
|
||||
}
|
||||
|
||||
function addPrefix(ClassMetadata $class_metadata) {
|
||||
public function addPrefix(ClassMetadata $class_metadata) {
|
||||
if (!$class_metadata->isInheritanceTypeSingleTable() || $class_metadata->getName() === $class_metadata->rootEntityName) {
|
||||
$class_metadata->setPrimaryTable([
|
||||
'name' => $this->prefix . $class_metadata->getTableName(),
|
||||
|
@ -7,7 +7,7 @@ use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
class JsonOrSerializedType extends JsonType {
|
||||
const NAME = 'json_or_serialized';
|
||||
|
||||
function convertToPHPValue($value, AbstractPlatform $platform) {
|
||||
public function convertToPHPValue($value, AbstractPlatform $platform) {
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
@ -22,7 +22,7 @@ class JsonOrSerializedType extends JsonType {
|
||||
return parent::convertToPHPValue($value, $platform);
|
||||
}
|
||||
|
||||
function getName() {
|
||||
public function getName() {
|
||||
return self::NAME;
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ use MailPoetVendor\Doctrine\DBAL\Types\Type;
|
||||
class JsonType extends Type {
|
||||
const NAME = 'json';
|
||||
|
||||
function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) {
|
||||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) {
|
||||
return $platform->getJsonTypeDeclarationSQL($fieldDeclaration);
|
||||
}
|
||||
|
||||
function convertToDatabaseValue($value, AbstractPlatform $platform) {
|
||||
public function convertToDatabaseValue($value, AbstractPlatform $platform) {
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
@ -27,7 +27,7 @@ class JsonType extends Type {
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
function convertToPHPValue($value, AbstractPlatform $platform) {
|
||||
public function convertToPHPValue($value, AbstractPlatform $platform) {
|
||||
if ($value === null || $value === '') {
|
||||
return null;
|
||||
}
|
||||
@ -41,11 +41,11 @@ class JsonType extends Type {
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
function getName() {
|
||||
public function getName() {
|
||||
return self::NAME;
|
||||
}
|
||||
|
||||
function requiresSQLCommentHint(AbstractPlatform $platform) {
|
||||
public function requiresSQLCommentHint(AbstractPlatform $platform) {
|
||||
return !$platform->hasNativeJsonType();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ class ValidationException extends \RuntimeException {
|
||||
/** @var ConstraintViolationListInterface|ConstraintViolationInterface[] */
|
||||
private $violations;
|
||||
|
||||
function __construct($resource_name, ConstraintViolationListInterface $violations) {
|
||||
public function __construct($resource_name, ConstraintViolationListInterface $violations) {
|
||||
$this->resource_name = $resource_name;
|
||||
$this->violations = $violations;
|
||||
|
||||
@ -23,17 +23,17 @@ class ValidationException extends \RuntimeException {
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
function getResourceName() {
|
||||
public function getResourceName() {
|
||||
return $this->resource_name;
|
||||
}
|
||||
|
||||
/** @return ConstraintViolationListInterface|ConstraintViolationInterface[] */
|
||||
function getViolations() {
|
||||
public function getViolations() {
|
||||
return $this->violations;
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
function getErrors() {
|
||||
public function getErrors() {
|
||||
$messages = [];
|
||||
foreach ($this->violations as $violation) {
|
||||
$messages[] = $this->formatError($violation);
|
||||
|
@ -13,11 +13,11 @@ class ValidatorFactory {
|
||||
/** @var AnnotationReaderProvider */
|
||||
private $annotation_reader_provider;
|
||||
|
||||
function __construct(AnnotationReaderProvider $annotation_reader_provider) {
|
||||
public function __construct(AnnotationReaderProvider $annotation_reader_provider) {
|
||||
$this->annotation_reader_provider = $annotation_reader_provider;
|
||||
}
|
||||
|
||||
function createValidator() {
|
||||
public function createValidator() {
|
||||
$builder = Validation::createValidatorBuilder();
|
||||
|
||||
// annotation reader exists only in dev environment, on production cache is pre-generated
|
||||
|
Reference in New Issue
Block a user