This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [friendsofphp/php-cs-fixer](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer) | `<3.64.1` -> `<3.85.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/PHP-CS-Fixer (friendsofphp/php-cs-fixer)</summary> ### [`v3.85.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3851) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.85.0...v3.85.1) - chore: update legacy deps ([#​8902](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8902)) ### [`v3.85.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3850) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.84.0...v3.85.0) - feat: `ArrayIndentationFixer` - handle closures inside attributes ([#​8888](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8888)) - feat: `NullableTypeDeclarationFixer` - support final promoted properties ([#​8885](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8885)) - feat: `OperatorLinebreakFixer` - support pipe operator ([#​8891](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8891)) - feat: `PhpdocTypesFixer` - support multiline array shapes ([#​8893](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8893)) - fix: always reach 100% of checked files ([#​8861](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8861)) - fix: `BracesPositionFixer` - handle property hooks correctly ([#​8886](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8886)) - fix: `NullableTypeDeclarationFixer` - handle abstract and final properties ([#​8876](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8876)) - fix: `PhpdocLineSpanFixer` - handle promoted properties ([#​8897](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8897)) - fix: `PhpUnitDataProviderNameFixer` - fix for multiple providers defined by attributes for one test method ([#​8849](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8849)) - fix: `TernaryOperatorSpacesFixer` - handle `instanceof static` ([#​8879](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8879)) - fix: `TypeDeclarationSpacesFixer` - handle asymmetric visibility and final properties ([#​8900](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8900)) - chore: add initial PHP 8.5 integration test ([#​8871](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8871)) - chore: add tests for public API methods ([#​8895](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8895)) - chore: apply changes from `PhpdocTypesFixer` for multiline array shapes ([#​8894](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8894)) - chore: baseline files without error count ([#​8870](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8870)) - chore: cleanup `PhpCsFixer\DocBlock\Annotation` ([#​8892](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8892)) - chore: Command name/descriptions - use attribute and static properties ([#​8862](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8862)) - chore: Commands - unify way to define help content ([#​8881](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8881)) - chore: ConfigurationResolver - add few missing v4 TODOs ([#​8882](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8882)) - chore: fix `booleanNot.exprNotBoolean` errors ([#​8869](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8869)) - chore: fix/optimize some phpdocs ([#​8889](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8889)) - chore: more unification of PHP CS Fixer naming ([#​8854](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8854)) - chore: PHPStan baseline - use `shipmonk/phpstan-baseline-per-identifier` ([#​8844](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8844)) - chore: remove dead code ([#​8896](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8896)) - chore: remove unused constants ([#​8864](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8864)) - chore: remove useless `@var` annotations ([#​8867](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8867)) - chore: simplify `ClassDefinitionFixer` ([#​8868](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8868)) - chore: unify usage of image versions to not mention minor ([#​8860](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8860)) - chore: update PHPStan ([#​8898](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8898)) - chore: update PHPStan extension for `Preg::match` ([#​8872](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8872)) - chore: wrong return values in `ErrorsManager` ([#​8863](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8863)) - chore: `OrderedInterfacesFixer` - make code more PHPStan friendly ([#​8866](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8866)) - chore: `Token` - add `@phpstan-assert-if-true` ([#​8865](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8865)) - deps: bump phpstan/phpstan from 2.1.17 to 2.1.18 in /dev-tools in the phpstan group ([#​8859](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8859)) - deps: bump the phpstan group in /dev-tools with 4 updates ([#​8890](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8890)) - docs: better document reprecated rule sets ([#​8878](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8878)) - docs: cleanup docs for PHP 7 ([#​8873](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8873)) - docs: cleanup docs for PHP < 7.4 ([#​8855](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8855)) - docs: ListSetsCommand,FixCommand - document possible formats in Command's definitions ([#​8880](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8880)) - DX: Explicitly prevent touching non-monolithic files ([#​6517](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/6517)) ### [`v3.84.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3840) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.83.0...v3.84.0) - feat: Introduce `NoUselessPrintfFixer` ([#​8820](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8820)) - feat: `CastSpacesFixer` - support `(void)` cast ([#​8851](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8851)) - feat: `NewExpressionParenthesesFixer` - add to `PHP84MigrationSet` ([#​8788](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8788)) - feat: `VisibilityRequiredFixer` - support final promoted properties ([#​8835](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8835)) - fix: `PhpdocToParamTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8842](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8842)) - fix: `PhpdocToPropertyTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8847](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8847)) - fix: `PhpdocToReturnTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8846](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8846)) - chore: introduce FCT for few missing tokens ([#​8845](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8845)) - chore: remove useless static variables for const content ([#​8836](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8836)) - chore: simplify `isGivenKind`/`equals`/`equalsAll` calls ([#​8843](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8843)) - docs: Support for new PHP version ([#​8780](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8780)) ### [`v3.83.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3830) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.2...v3.83.0) - feat: Suppress enable parallel runner message when only 1 core is available ([#​8833](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8833)) - fix: BracesPositionFixer - fix performance issue for massive files with CT::T\_CURLY\_CLOSE ([#​8830](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8830)) - fix: `NoUnreachableDefaultArgumentValueFixer` - do not crash on property hook ([#​8838](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8838)) - chore: Add CS commit to .git-blame-ignore-revs - chore: apply native\_constant\_invocation for build-in consts ([#​8837](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8837)) - chore: configure native\_constant\_invocation ([#​8840](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8840)) - chore: early compat check with Symfony 8 ([#​8827](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8827)) - chore: `FullyQualifiedStrictTypesFixer` - reduce function calls ([#​8834](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8834)) - CI: mark jobs allow-to-fail declarative, instead of imperative check ([#​8829](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8829)) ### [`v3.82.2`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3822) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.1...v3.82.2) - fix: `ClassAttributesSeparationFixer` - handle method `get` aliased in trait import ([#​8822](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8822)) - fix: `LowercaseStaticReferenceFixer` - do not touch enum's cases ([#​8824](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8824)) - fix: `StatementIndentationFixer` - multi constant statement containing array ([#​8825](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8825)) - fix: `VisibilityRequiredFixer` - handle promoted property with visibility and reference, but without type ([#​8823](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8823)) ### [`v3.82.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3821) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.0...v3.82.1) - fix: `OrderedClassElementsFixer` - handle property hooks ([#​8817](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8817)) - fix: `SingleClassElementPerStatementFixer` - fix for property hooks ([#​8816](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8816)) ### [`v3.82.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3820) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.81.0...v3.82.0) - chore: cleanup `FCTTest` ([#​8808](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8808)) - chore: PhpdocOrderFixer.php - CPU optimization ([#​8812](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8812)) - deps: update box ([#​8795](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8795)) - docs: fix whitespace around code examples and reference sections in rules' docs ([#​8810](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8810)) - feat: `MagicConstantCasingFixer` - support `__PROPERTY__` ([#​8809](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8809)) - feat: `PhpUnitDataProviderNameFixer` - support data providers defined by both annotation and attribute for the same test ([#​8811](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8811)) - fix: `PhpdocToParamTypeFixer` - always handle reference in PHPDoc ([#​8813](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8813)) ### [`v3.81.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3810) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.80.0...v3.81.0) - feat: `VisibilityRequiredFixer` - handle more than only the first promoted property ([#​8801](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8801)) - fix: `BracesPositionFixer` - do not crash when variable is terminated by PHP close tag ([#​8804](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8804)) - fix: `PhpUnitDataProviderMethodOrderFixer` - handle data provider defined by both annotation and attribute ([#​8805](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8805)) - fix: `PhpUnitInternalClassFixer` - skip adding `@internal` on instantiation of anonymous classes ([#​8807](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8807)) - fix: `VisibilityRequiredFixer` - handle promoted parameter passed by reference ([#​8799](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8799)) - chore: add automatically to milestone "PHP 8.5 initial compatibility" if label is "topic/PHP8.5" ([#​8806](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8806)) - chore: fail "Deployment checks" if any job from `tests` failed ([#​8792](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8792)) - docs: update docs about --allow-unsupported-php-version ([#​8796](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8796)) ### [`v3.80.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3800) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.79.0...v3.80.0) - feat: PHP 8.4 compatibility support ([#​8300](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8300)) ### [`v3.79.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3790) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.78.1...v3.79.0) - chore: `VisibilityRequiredFixerTest` - run tests in correct PHP version ([#​8790](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8790)) - feat: `BracesPositionFixer` - do not touch one-line properties with hooks ([#​8785](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8785)) - feat: `PhpUnitDataProvider(.+)Fixer` - support attributes ([#​8197](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8197)) ### [`v3.78.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3781) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.78.0...v3.78.1) - fix: `VisibilityRequiredFixer` - do not add `public` incorrectly ([#​8787](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8787)) ### [`v3.78.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3780) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.77.0...v3.78.0) - chore: `VisibilityRequiredFixer` - document behaviour for asymmetric visibility with only set-visibility ([#​8783](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8783)) - feat: `BracesPositionFixer` - support property hooks ([#​8782](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8782)) - feat: `VisibilityRequiredFixer` - support promoted property without visibility ([#​8773](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8773)) - fix: `NativeFunctionInvocationFixer` - fix global function `set` called in array key ([#​8568](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8568)) - fix: `NoBreakCommentFixer` - handle function having return type ([#​8767](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8767)) - fix: `StatementIndentationFixer` - handle functions `set` and `get` (like property hooks, but not) ([#​8576](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8576)) - fix: `StaticPrivateMethodFixer` - handle nested calls ([#​8768](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8768)) ### [`v3.77.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3770) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.76.0...v3.77.0) - chore: add automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8770](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8770)) - chore: Add CS commit to .git-blame-ignore-revs - chore: fix adding automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8775](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8775)) - chore: fix adding automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8776](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8776)) - chore: move all indicators to analyzers ([#​8772](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8772)) - chore: move PHP-compat integration tests ([#​8781](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8781)) - chore: partially apply NoExtraBlankLinesFixer:tokens.comma ([#​8762](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8762)) - chore: reconfigure phpdoc\_order in local config ([#​8220](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8220)) - feat: PhpdocOrderFixer - extend support for phpstan and psalm annotations ([#​8777](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8777)) - feat: support anonymous classes extending `TestCase` in PHPUnit fixers ([#​8707](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8707)) - feat: `CommentToPhpdocFixer` and `PhpdocToCommentFixer` - support asymmetric visibility ([#​8774](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8774)) - feat: `NoEmptyStatementFixer` - support abstract property hooks ([#​8766](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8766)) - feat: `NullableTypeDeclarationForDefaultNullValueFixer` - support asymmetric visibility in the constructor ([#​8604](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8604)) - feat: `ProtectedToPrivateFixer` - add support for promoted properties ([#​8608](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8608)) - fix: `PhpUnitAttributesFixer` - correctly remove annotations when configured `['keep_annotations' => false]` ([#​8577](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8577)) - fix: `ProtectedToPrivateFixer` - fix asymmetric visibility with only set visibility ([#​8763](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8763)) ### [`v3.76.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3760) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.75.0...v3.76.0) - chore(release): bump php ci alpine version ([#​8581](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8581)) - chore: add missing priority test for `BracesPositionFixer` and `MultilinePromotedPropertiesFixer` ([#​8596](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8596)) - chore: add more assertions in tests ([#​8740](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8740)) - chore: bump dependencies version to maximum for non-newest MAJOR version ([#​8753](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8753)) - chore: cast types in tests ([#​8742](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8742)) - chore: cleanup booleans use in tests ([#​8738](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8738)) - chore: cleanup code in tests ([#​8745](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8745)) - chore: cleanup PsrAutoloadingFixerTest.php keywords handling, as always defined currently ([#​8730](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8730)) - chore: cleanup `AlignMultilineCommentFixerTest` ([#​8688](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8688)) - chore: cleanup `BinaryOperatorSpacesFixerTest` ([#​8687](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8687)) - chore: cleanup `BlankLineBeforeStatementFixerTest` ([#​8685](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8685)) - chore: cleanup `ClassDefinitionFixerTest` ([#​8684](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8684)) - chore: cleanup `ClassDefinitionFixer` ([#​8580](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8580)) - chore: cleanup `ConcatSpaceFixerTest` ([#​8683](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8683)) - chore: cleanup `DoctrineAnnotationArrayAssignmentFixerTest` ([#​8621](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8621)) - chore: cleanup `DoctrineAnnotationBracesFixerTest` ([#​8623](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8623)) - chore: cleanup `DoctrineAnnotationIndentationFixerTest` ([#​8620](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8620)) - chore: cleanup `DoctrineAnnotationSpacesFixerTest` ([#​8624](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8624)) - chore: cleanup `EchoTagSyntaxFixerTest` ([#​8681](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8681)) - chore: cleanup `file_get_contents` return types ([#​8735](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8735)) - chore: cleanup `FunctionDeclarationFixerTest` ([#​8680](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8680)) - chore: cleanup `FunctionToConstantFixerTest` ([#​8618](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8618)) - chore: cleanup `GeneralPhpdocTagRenameFixerTest` ([#​8627](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8627)) - chore: cleanup `GlobalNamespaceImportFixerTest` ([#​8679](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8679)) - chore: cleanup `HeaderCommentFixerTest` ([#​8677](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8677)) - chore: cleanup `HeaderCommentFixerTest` (restore `@requires` for PHP 8.1) ([#​8678](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8678)) - chore: cleanup `IncrementStyleFixerTest` ([#​8676](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8676)) - chore: cleanup `IndentationTypeFixerTest` ([#​8675](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8675)) - chore: cleanup `ListSyntaxFixerTest` ([#​8674](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8674)) - chore: cleanup `MethodArgumentSpaceFixerTest` ([#​8673](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8673)) - chore: cleanup `MultilineWhitespaceBeforeSemicolonsFixerTest` ([#​8614](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8614)) - chore: cleanup `NativeConstantInvocationFixerTest` ([#​8672](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8672)) - chore: cleanup `NewWithParenthesesFixerTest` ([#​8592](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8592)) - chore: cleanup `NoBlankLinesAfterPhpdocFixerTest` ([#​8671](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8671)) - chore: cleanup `NoBreakCommentFixerTest` ([#​8670](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8670)) - chore: cleanup `NoClosingTagFixerTest` ([#​8669](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8669)) - chore: cleanup `NoEmptyStatementFixerTest` ([#​8667](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8667)) - chore: cleanup `NoSpacesAroundOffsetFixerTest` ([#​8666](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8666)) - chore: cleanup `NoUnneededControlParenthesesFixerTest` ([#​8665](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8665)) - chore: cleanup `NoUselessElseFixerTest` ([#​8664](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8664)) - chore: cleanup `PhpdocAddMissingParamAnnotationFixerTest` ([#​8663](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8663)) - chore: cleanup `PhpdocNoEmptyReturnFixerTest` ([#​8662](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8662)) - chore: cleanup `PhpdocNoPackageFixerTest` ([#​8626](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8626)) - chore: cleanup `PhpdocOrderByValueFixerTest` ([#​8661](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8661)) - chore: cleanup `PhpdocOrderFixerTest` ([#​8660](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8660)) - chore: cleanup `PhpdocParamOrderFixerTest` ([#​8659](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8659)) - chore: cleanup `PhpdocReturnSelfReferenceFixerTest` ([#​8658](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8658)) - chore: cleanup `PhpdocSeparationFixerTest` ([#​8657](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8657)) - chore: cleanup `PhpdocSummaryFixerTest` ([#​8654](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8654)) - chore: cleanup `PhpdocTrimFixerTest` ([#​8653](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8653)) - chore: cleanup `PhpdocTypesOrderFixerTest` ([#​8652](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8652)) - chore: cleanup `PhpdocVarWithoutNameFixerTest` ([#​8617](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8617)) - chore: cleanup `PhpUnitConstructFixerTest` ([#​8651](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8651)) - chore: cleanup `PhpUnitDedicateAssertFixerTest` ([#​8650](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8650)) - chore: cleanup `PhpUnitTestCaseStaticMethodCallsFixerTest` ([#​8649](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8649)) - chore: cleanup `Preg` issues ([#​8720](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8720)) - chore: cleanup `ReturnAssignmentFixerTest` ([#​8648](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8648)) - chore: cleanup `ReturnTypeDeclarationFixerTest` ([#​8647](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8647)) - chore: cleanup `SingleImportPerStatementFixerTest` ([#​8645](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8645)) - chore: cleanup `SingleLineCommentStyleFixerTest` ([#​8644](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8644)) - chore: cleanup `SingleSpaceAroundConstructFixerTest` ([#​8642](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8642)) - chore: cleanup `SpaceAfterSemicolonFixerTest` ([#​8625](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8625)) - chore: cleanup `SpacesInsideParenthesesFixerTest` ([#​8641](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8641)) - chore: cleanup `StatementIndentationFixerTest` ([#​8640](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8640)) - chore: cleanup `YodaStyleFixerTest` ([#​8638](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8638)) - chore: do not check if `JSON_INVALID_UTF8_IGNORE` is defined because it always is (since PHP 7.2) ([#​8709](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8709)) - chore: handle saveXML failures explicitly ([#​8755](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8755)) - chore: ignore remaining PHPStan (false positive) issues ([#​8746](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8746)) - chore: improve PHPDoc's types in ([#​8741](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8741)) - chore: improve PHPDocs in tests ([#​8736](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8736)) - chore: improve PHPDocs in tests ([#​8744](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8744)) - chore: improve type of `Token::equalsAny` ([#​8743](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8743)) - chore: lint yaml files ([#​8622](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8622)) - chore: MultilinePromotedPropertiesFixer - mark new fixer introduced in [#​8595](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8595) as experimental ([#​8758](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8758)) - chore: PHPMD - cleanup `UnusedLocalVariable` for `foreach` ([#​8637](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8637)) - chore: refactor FCT ([#​8714](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8714)) - chore: remove unused local variables in src ([#​8600](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8600)) - chore: remove unused local variables in tests ([#​8599](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8599)) - chore: remove useless test from `AliasedFixerOptionTest` ([#​8739](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8739)) - chore: remove `defined` calls from tests ([#​8708](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8708)) - chore: restore original type of Token::equalsAny, partially reverts [#​8743](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8743) ([#​8759](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8759)) - chore: run mutation tests on PHP 8.4 ([#​8594](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8594)) - chore: solve one of phpstan warnings ([#​8754](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8754)) - chore: update dev tools ([#​8737](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8737)) - chore: update PHPUnit config ([#​8721](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8721)) - chore: update `checkbashisms` to 2.25.12 ([#​8694](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8694)) - chore: update `checkbashisms` to 2.25.14 ([#​8731](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8731)) - chore: use PHPStan type in data providers ([#​8605](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8605)) - chore: use `foreach` values ([#​8636](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8636)) - chore: use `Preg` class everywhere ([#​8689](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8689)) - CI: add self-approved label ([#​8757](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8757)) - CI: run on PHP 8.5 ([#​8713](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8713)) - deps: bump alpine from 3.21.3 to 3.22.0 ([#​8724](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8724)) - deps: bump alpine from 3.21.3 to 3.22.0 ([#​8726](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8726)) - deps: bump ergebnis/composer-normalize from 2.45.0 to 2.46.0 in /dev-tools ([#​8578](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8578)) - deps: bump ergebnis/composer-normalize from 2.46.0 to 2.47.0 in /dev-tools ([#​8584](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8584)) - deps: bump phpstan/phpstan from 2.1.11 to 2.1.12 in /dev-tools in the phpstan group ([#​8583](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8583)) - deps: bump phpstan/phpstan-symfony from 2.0.3 to 2.0.4 in /dev-tools in the phpstan group ([#​8557](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8557)) - deps: bump the phpstan group across 1 directory with 2 updates ([#​8682](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8682)) - deps: upgrade docker deps ([#​8566](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8566)) - docs: extend and fix links to code ([#​8639](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8639)) - docs: Update SECURITY.md ([#​8716](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8716)) - docs: VisibilityRequiredFixer - extend docs ([#​8561](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8561)) - docs: `VisibilityRequiredFixer` - update docs ([#​8563](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8563)) - DX: add `symfony/polyfill-php84` ([#​8555](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8555)) - DX: always use the latest stable `checkbashisms` package ([#​8732](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8732)) - DX: check for `preg_` functions in tests ([#​8571](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8571)) - DX: cleanup `BlankLinesBeforeNamespaceFixerTest` ([#​8573](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8573)) - DX: cleanup `NativeFunctionInvocationFixerTest` ([#​8567](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8567)) - DX: cleanup `NoUselessConcatOperatorFixerTest` ([#​8572](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8572)) - DX: cleanup `SemicolonAfterInstructionFixerTest` ([#​8570](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8570)) - DX: fix data providers ([#​8693](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8693)) - DX: introduce `FCT` class for tokens not present in the lowest supported PHP version ([#​8706](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8706)) - DX: move `symfony/polyfill-php84` to dev deps ([#​8559](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8559)) - DX: support PHP 8.4 in local Docker development environment ([#​8564](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8564)) - DX: trim array/yield keys ([#​8460](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8460)) - DX: use `WhitespacesAwareFixerInterface` only when needed ([#​8541](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8541)) - feat: add `NewExpressionParenthesesFixer` ([#​8246](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8246)) - feat: allowUnsupportedPhpVersion ([#​8733](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8733)) - feat: introduce `MultilinePromotedPropertiesFixer` ([#​8595](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8595)) - feat: Introduce `StaticPrivateMethodFixer` ([#​4557](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/4557)) - feat: `BracesPositionFixer` - support property hooks in promoted properties ([#​8613](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8613)) - feat: `ClassAttributesSeparationFixer` - add support for property hooks ([#​8610](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8610)) - feat: `GlobalNamespaceImportFixer` - analyze and fix more annotations with types ([#​8593](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8593)) - feat: `LowercaseKeywordsFixer` - support asymmetric visibility ([#​8607](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8607)) - feat: `NoExtraBlankLinesFixer` - add comma to supported tokens ([#​8655](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8655)) - feat: `NoSuperfluousPhpdocTagsFixer` - support asymmetric visibility ([#​8700](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8700)) - feat: `NullableTypeDeclarationFixer` - support asymmetric visibility ([#​8697](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8697)) - feat: `OrderedClassElementsFixer` - add support for property hooks for abstract properties ([#​8574](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8574)) - feat: `OrderedTypesFixer` - add support for asymmetric visibility ([#​8552](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8552)) - feat: `OrderedTypesFixer` - support asymmetric visibility in promoted property ([#​8602](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8602)) - feat: `PhpdocAddMissingParamAnnotationFixer` - support asymmetric visibility ([#​8701](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8701)) - feat: `PhpdocLineSpanFixer` - support asymmetric visibility ([#​8702](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8702)) - feat: `PhpdocVarWithoutNameFixer` - support asymmetric visibility ([#​8704](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8704)) - feat: `ProtectedToPrivateFixer` - add support for asymmetric visibility ([#​8569](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8569)) - feat: `SingleClassElementPerStatementFixer` - support asymmetric visibility ([#​8696](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8696)) - feat: `SingleSpaceAroundConstructFixer` - add support for asymmetric visibility ([#​8699](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8699)) - feat: `StaticLambdaFixer` - support functions having classy elements with `$this` ([#​8728](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8728)) - feat: `VisibilityRequiredFixer` - support ordering set-visibility modifier ([#​8606](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8606)) - fix(dependabot): convert time values to string types ([#​8634](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8634)) - fix: "array" type must have no prefix to be fixable to "list" ([#​8692](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8692)) - fix: "min"/"max" in int generics must never be prefixed by backslash ([#​8691](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8691)) - fix: Allow non-doc comment on opening inline brace line ([#​8690](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8690)) - fix: `ConstantCaseFixer` - do not touch namespaces starting with `Null\` ([#​8752](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8752)) - fix: `LowercaseStaticReferenceFixer` - do not change global constants ([#​8727](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8727)) - fix: `MultilineWhitespaceBeforeSemicolonsFixer` - do not touch multiline constants definitions ([#​8615](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8615)) - fix: `NewWithParenthesesFixer` - fix `new` without parentheses on PHP 8.4 syntax ([#​8588](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8588)) - fix: `NoMultipleStatementsPerLineFixer` - handle `set` and `get` in different casing in property hooks ([#​8558](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8558)) - fix: `NoUnusedImportsFixer` - handle imported class name with underscore before or after it in PHPDoc ([#​8598](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8598)) - fix: `PhpUnitDedicateAssertFixer` - fix for `assertFalse` with `instanceof` ([#​8597](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8597)) - fix: `PhpUnitNamespacedFixer` must rune before `NoUnneededImportAliasFixer` ([#​8579](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8579)) - fix: `PhpUnitTestClassRequiresCoversFixer` - do not add `@coversNothing` annotation when `CoversTrait` attribute is used ([#​8734](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8734)) - fix: `VisibilityRequiredFixer` - add support for asymmetric visibility ([#​8586](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8586)) - refactor: avoid unused local variables in tests ([#​8609](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8609)) - test: add more cases to `PhpUnitMethodCasingFixerTest` ([#​8551](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8551)) - test: fix "unused local variables `$token`" ([#​8603](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8603)) - test: More verbose error output for integration test ([#​8565](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8565)) - Update SECURITY.md ### [`v3.75.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3750) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.74.0...v3.75.0) - feat: `ClassAttributesSeparationFixer` - add support for asymmetric visibility ([#​8518](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8518)) - fix: `NativeFunctionInvocationFixer` - fix for property hooks ([#​8540](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8540)) - chore: add return types for data providers for fixers ([#​8542](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8542)) - chore: add return types for data providers for non-fixers ([#​8543](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8543)) - chore: add return types for remaining data providers ([#​8544](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8544)) - chore: make data providers key type `int` if all the keys are strings ([#​8550](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8550)) - chore: make data providers key type `string` if all the keys are strings ([#​8545](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8545)) - chore: SwitchContinueToBreakFixerTest - improve test case descriptions/typehint ([#​8546](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8546)) - chore: `FunctionsAnalyzerTest` cleanup ([#​8539](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8539)) - deps: bump the phpstan group in /dev-tools with 2 updates ([#​8537](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8537)) - test: ProjectCodeTest::testDataProvidersDeclaredReturnType - allow for int as iterable keys ([#​8548](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8548)) ### [`v3.74.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3740) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.73.1...v3.74.0) - feat: add `--format=@​auto` ([#​8513](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8513)) - fix: `BracesPositionFixer` - do not create two consecutive whitespace tokens ([#​8496](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8496)) - fix: `MbStrFunctionsFixer` - fix imports with leading backslash ([#​8507](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8507)) - fix: `NoUnreachableDefaultArgumentValueFixer` - do not crash on property hook ([#​8512](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8512)) - fix: `OrderedImportsFixer` - do not take the braces part in grouped imports into account ([#​8459](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8459)) - fix: `OrderedImportsFixer` - fix syntax error with grouped use statement and multiple use with comma ([#​8483](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8483)) - fix: `PhpUnitAttributesFixer` - handle parentheses after data provider method name ([#​8510](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8510)) - fix: `PhpUnitMethodCasingFixer` - do not touch anonymous class ([#​8463](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8463)) - chore: make options that have default and allowed sets the same size the same array ([#​8529](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8529)) - chore: update return type of `FixerOptionInterface::getAllowedValues` ([#​8530](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8530)) - chore: `Preg` - improve types ([#​8527](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8527)) - CI: fix code coverage job ([#​8520](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8520)) - CI: try MacOS job without ParaUnit ([#​8528](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8528)) - deps: update PHPStan ([#​8531](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8531)) - deps: upgrade `PHPStan/*` ([#​8524](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8524)) ### [`v3.73.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3731) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.73.0...v3.73.1) - fix: `OrderedClassElementsFixer` - do not crash on property hook ([#​8517](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8517)) ### [`v3.73.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3730) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.72.0...v3.73.0) - feat: add support for asymmetric visibility to Doctrine's fixers ([#​8415](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8415)) - fix: `GeneralPhpdocTagRenameFixer` - do not rename keys in array shape definition ([#​8477](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8477)) - fix: `MethodArgumentSpaceFixer` - handle when nested in HTML ([#​8503](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8503)) - chore: update `checkbashisms` to 2.25.5 ([#​8519](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8519)) - DX: cleanup `NoExtraBlankLinesFixerTest` ([#​8505](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8505)) - DX: for duplicated test methods check methods without parameters ([#​8508](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8508)) - DX: remove more duplicated test methods ([#​8506](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8506)) - refactor: `Tokenizer` hash metode using `xxHash` ([#​8491](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8491)) - refactor: `TokensAnalyzerTest` - better test `isArray` and `isArrayMultiLine` ([#​8504](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8504)) - test: run code coverage on PHP 8.4 ([#​8448](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8448)) ### [`v3.72.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3720) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.71.0...v3.72.0) - feat: `StatementIndentationFixer` - handle property hooks ([#​8492](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8492)) - fix: `MbStrFunctionsFixer` - fix imports ([#​8474](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8474)) - fix: `TrailingCommaInMultilineFixer` - handle empty match body ([#​8480](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8480)) - fix: `VisibilityRequiredFixer` - handle property hooks ([#​8495](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8495)) - deps: upgrade few dev-deps ([#​8490](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8490)) - deps: Upgrade PHPStan to 2.1.8 ([#​8489](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8489)) - DX: add trailing comma to multiline auto-generated types ([#​8499](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8499)) - refactor: generalize CodeHasher into Hasher ([#​8500](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8500)) - refactor: Runner - unify paths used when using parallel runner ([#​8488](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8488)) - refactor: use Hasher instead of md5 directly ([#​8501](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8501)) ### [`v3.71.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3710) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.2...v3.71.0) - feat: OrderedImportsFixer - deprecate length sorting algorithm ([#​8473](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8473)) - fix: `BinaryOperatorSpacesFixer` - do not break alignment of UTF-8 array keys ([#​8484](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8484)) - fix: `PhpdocAlignFixer` - align correctly type with UTF8 characters ([#​8486](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8486)) - fix: `SingleSpaceAroundConstructFixer` - handle alternative syntax ([#​8317](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8317)) - fix: `StatementIndentationFixer` - return in braceless if ([#​8479](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8479)) - chore: update type in `SingleSpaceAroundConstructFixerTest::provideFixWithElseIfCases` ([#​8481](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8481)) - chore: update type in `SingleSpaceAroundConstructFixerTest::provideFixWithIfCases` ([#​8482](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8482)) - deps: bump phpstan/phpstan from 2.1.6 to 2.1.7 in /dev-tools in the phpstan group ([#​8485](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8485)) - DX: cleanup `PhpdocNoAliasTagFixerTest` ([#​8476](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8476)) - refactor: add `FullyQualifiedNameAnalyzer` ([#​8048](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8048)) - refactor: codeHash - update when it's (re-)generated ([#​8470](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8470)) - refactor: `SwitchAnalyzer` - improve performance ([#​8407](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8407)) - test: NameQualifiedTransformerTest - correct test case ([#​8471](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8471)) ### [`v3.70.2`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3702) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.1...v3.70.2) - deps: upgrade deep dev-tools deps ([#​8472](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8472)) - fix: `MbStrFunctionsFixer` must run before `NativeFunctionInvocationFixer` ([#​8466](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8466)) - fix: `MethodArgumentSpaceFixer` - fix nested calls for `ensure_fully_multiline` option ([#​8469](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8469)) ### [`v3.70.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3701) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.0...v3.70.1) - fix: `PhpUnitSizeClassFixer` must run before `PhpUnitAttributesFixer` ([#​8457](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8457)) - DX: cleanup `OrderedImportsFixerTest` ([#​8458](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8458)) ### [`v3.70.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3700) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.69.1...v3.70.0) - feat: Add `PhpUnitDataProviderMethodOrderFixer` fixer ([#​8225](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8225)) - feat: `HeaderCommentFixer` - allow validators ([#​8452](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8452)) - feat: `PhpCsFixer` ruleset: use `operator_linebreak` rule for all operators ([#​8417](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8417)) - feat: `PhpUnitMethodCasingFixer` to support PHPUnit's `Test` attribute ([#​8451](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8451)) - feat: `TypeDeclarationSpacesFixer` - Fix whitespace between const type and const name ([#​8442](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8442)) - chore: extend bug report template ([#​8447](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8447)) - chore: extend bug report template - more installation options ([#​8450](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8450)) - CI: phpstan-symfony - add entry point for console ([#​8292](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8292)) - deps: bump alpine from 3.21.2 to 3.21.3 ([#​8454](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8454)) - deps: bump phpstan/phpstan from 2.1.5 to 2.1.6 in /dev-tools in the phpstan group ([#​8453](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8453)) - fix: `CommentsAnalyzer` - allow other forms of assignment as valid structural elements for PHPDocs ([#​8371](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8371)) - fix: `PhpUnitTestClassRequiresCoversFixer` must run before `PhpUnitAttributesFixer` ([#​8444](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8444)) - test: fix `CheckCommandTest::testDryRunModeIsUnavailable` to correctly check that option `--dry-run` is unavailable ([#​8438](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8438)) ### [`v3.69.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3691) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.69.0...v3.69.1) - fix: `PhpUnitAttributesFixer` - convert correctly version constraint ([#​8439](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8439)) - test: `PhpUnitAttributesFixer` must run before `NoEmptyPhpdocFixer` ([#​8443](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8443)) ### [`v3.69.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3690) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.68.5...v3.69.0) - feat: Add unsealed array shape phpdoc support ([#​8299](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8299)) - fix: `OrderedClassElementsFixer` - sort correctly typed constants ([#​8408](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8408)) - chore: do not use test class as test data ([#​8430](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8430)) - chore: update `checkbashisms` to 2.25.2 ([#​8427](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8427)) - chore: use constants instead of literal strings ([#​8422](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8422)) - CI: no need to unlock deps on master ([#​8426](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8426)) - CI: run tests using PHPUnit 12 ([#​8431](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8431)) - deps: bump kubawerlos/composer-s </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/libretime/libretime). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicGhwIl19--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: jo <ljonas@riseup.net>
1741 lines
58 KiB
PHP
1741 lines
58 KiB
PHP
<?php
|
|
|
|
class Application_Model_Show
|
|
{
|
|
private $_showId;
|
|
|
|
public function __construct($showId = null)
|
|
{
|
|
$this->_showId = $showId;
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbName();
|
|
}
|
|
|
|
public function setName($name)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbName($name);
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
}
|
|
|
|
public function setAirtimeAuthFlag($flag)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbLiveStreamUsingAirtimeAuth($flag);
|
|
$show->save();
|
|
}
|
|
|
|
public function setCustomAuthFlag($flag)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbLiveStreamUsingCustomAuth($flag);
|
|
$show->save();
|
|
}
|
|
|
|
public function setCustomUsername($username)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbLiveStreamUser($username);
|
|
$show->save();
|
|
}
|
|
|
|
public function setCustomPassword($password)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbLiveStreamPass($password);
|
|
$show->save();
|
|
}
|
|
|
|
public function getDescription()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbDescription();
|
|
}
|
|
|
|
public function setDescription($description)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbDescription($description);
|
|
}
|
|
|
|
public function getColor()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbColor();
|
|
}
|
|
|
|
public function setColor($color)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbColor($color);
|
|
}
|
|
|
|
public function getUrl()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbUrl();
|
|
}
|
|
|
|
/*TODO : This method is not actually used anywhere as far as I can tell. We
|
|
can safely remove it and probably many other superfluous methods.
|
|
--RG*/
|
|
|
|
public function setUrl($p_url)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbUrl($p_url);
|
|
}
|
|
|
|
public function getGenre()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbGenre();
|
|
}
|
|
|
|
public function setGenre($p_genre)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbGenre($p_genre);
|
|
}
|
|
|
|
public function getBackgroundColor()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
$color = $show->getDbBackgroundColor();
|
|
if (empty($color)) {
|
|
return DEFAULT_SHOW_COLOR;
|
|
}
|
|
|
|
return $color;
|
|
}
|
|
|
|
public function setBackgroundColor($backgroundColor)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbBackgroundColor($backgroundColor);
|
|
}
|
|
|
|
public function getId()
|
|
{
|
|
return $this->_showId;
|
|
}
|
|
|
|
public function getHasAutoPlaylist()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbHasAutoPlaylist();
|
|
}
|
|
|
|
public function getAutoPlaylistRepeat()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbAutoPlaylistRepeat();
|
|
}
|
|
|
|
public function setAutoPlaylistRepeat($value)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbAutoPlaylistRepeat($value);
|
|
}
|
|
|
|
public function setHasAutoPlaylist($value)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbHasAutoPlaylist($value);
|
|
}
|
|
|
|
public function getAutoPlaylistId()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbAutoPlaylistId();
|
|
}
|
|
|
|
public function setAutoPlaylistId($playlistid)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->setDbAutoPlaylistId($playlistid);
|
|
}
|
|
|
|
public function getHasOverrideIntroPlaylist()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbOverrideIntroPlaylist();
|
|
}
|
|
|
|
public function getIntroPlaylistId()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
if ($show->getDbOverrideIntroPlaylist()) {
|
|
return $show->getDbIntroPlaylistId();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public function setIntroPlaylistId($playlistid)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
$show->setDbOverrideIntroPlaylist($playlistid != 0);
|
|
$show->setDbIntroPlaylistId($playlistid);
|
|
}
|
|
|
|
public function getHasOverrideOutroPlaylist()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
return $show->getDbOverrideOutroPlaylist();
|
|
}
|
|
|
|
public function getOutroPlaylistId()
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
if ($show->getDbOverrideOutroPlaylist()) {
|
|
return $show->getDbOutroPlaylistId();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public function setOutroPlaylistId($playlistid)
|
|
{
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
|
|
$show->setDbOverrideOutroPlaylist($playlistid != 0);
|
|
$show->setDbOutroPlaylistId($playlistid);
|
|
}
|
|
|
|
public function getHosts()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT first_name,
|
|
last_name
|
|
FROM cc_show_hosts
|
|
LEFT JOIN cc_subjs ON cc_show_hosts.subjs_id = cc_subjs.id
|
|
WHERE show_id = :show_id
|
|
SQL;
|
|
|
|
$hosts = Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[':show_id' => $this->getId()],
|
|
'all'
|
|
);
|
|
|
|
$res = [];
|
|
foreach ($hosts as $host) {
|
|
$res[] = $host['first_name'] . ' ' . $host['last_name'];
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
|
|
public function getHostsIds()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT subjs_id
|
|
FROM cc_show_hosts
|
|
WHERE show_id = :show_id
|
|
SQL;
|
|
|
|
return Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[':show_id' => $this->getId()],
|
|
'all'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* remove everything about this show.
|
|
*/
|
|
public function delete()
|
|
{
|
|
// usually we hide the show-instance, but in this case we are deleting the show template
|
|
// so delete all show-instances as well.
|
|
CcShowInstancesQuery::create()->filterByDbOriginalShow($this->_showId)->delete();
|
|
|
|
$show = CcShowQuery::create()->findPK($this->_showId);
|
|
$show->delete();
|
|
}
|
|
|
|
public function resizeShow($deltaDay, $deltaMin, $instanceId)
|
|
{
|
|
$con = Propel::getConnection();
|
|
|
|
if ($deltaDay > 0) {
|
|
return _('Shows can have a max length of 24 hours.');
|
|
}
|
|
|
|
$utcTimezone = new DateTimeZone('UTC');
|
|
$nowDateTime = new DateTime('now', $utcTimezone);
|
|
|
|
// keep track of cc_show_day entries we need to update
|
|
$showDayIds = [];
|
|
|
|
/*
|
|
* If the resized show is an edited instance of a repeating show we
|
|
* need to treat it as a separate show and not resize the other instances
|
|
*
|
|
* Also, if the resized show has edited instances, we need to exclude
|
|
* those from the resize
|
|
*/
|
|
$ccShow = CcShowQuery::create()->findPk($this->_showId);
|
|
if ($ccShow->isRepeating()) {
|
|
// convert instance to local timezone
|
|
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
|
$startsDT = $ccShowInstance->getDbStarts(null);
|
|
$timezone = $ccShow->getFirstCcShowDay()->getDbTimezone();
|
|
$startsDT->setTimezone(new DateTimeZone($timezone));
|
|
|
|
/* Get cc_show_day for the current instance. If we don't find one
|
|
* we know it is a repeat interval of one of cc_show_days first
|
|
* show and we can assume we aren't resizing a modified instance
|
|
*/
|
|
$ccShowDay = CcShowDaysQuery::create()
|
|
->filterByDbFirstShow($startsDT->format('Y-m-d'))
|
|
->filterByDbStartTime($startsDT->format('H:i:s'))
|
|
->filterByDbShowId($this->_showId)
|
|
->findOne();
|
|
|
|
/* Check if this cc_show_day rule is non-repeating. If it is, then
|
|
* we know this instance was edited out of the repeating sequence
|
|
*/
|
|
if (!$ccShowDay || $ccShowDay->getDbRepeatType() != -1) {
|
|
$ccShowDays = $ccShow->getRepeatingCcShowDays();
|
|
foreach ($ccShowDays as $day) {
|
|
array_push($showDayIds, $day->getDbId());
|
|
}
|
|
|
|
$excludeIds = $ccShow->getEditedRepeatingInstanceIds();
|
|
|
|
// exlcude edited instances from resize
|
|
$showInstances = CcShowInstancesQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->filterByDbModifiedInstance(false)
|
|
->filterByDbId($excludeIds, criteria::NOT_IN)
|
|
->find();
|
|
} elseif ($ccShowDay->getDbRepeatType() == -1) {
|
|
array_push($showDayIds, $ccShowDay->getDbId());
|
|
|
|
// treat edited instance as separate show for resize
|
|
$showInstances = CcShowInstancesQuery::create()
|
|
->filterByDbId($instanceId)
|
|
->find();
|
|
}
|
|
} else {
|
|
$ccShowDays = $ccShow->getCcShowDayss();
|
|
foreach ($ccShowDays as $day) {
|
|
array_push($showDayIds, $day->getDbId());
|
|
}
|
|
|
|
$showInstances = CcShowInstancesQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->find($con);
|
|
}
|
|
|
|
/* Check two things:
|
|
1. If the show being resized and any of its repeats end in the past
|
|
2. If the show being resized and any of its repeats overlap
|
|
with other scheduled shows */
|
|
|
|
// keep track of instance ids for update show instances start/end times
|
|
$instanceIds = [];
|
|
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
|
|
|
// check if new show time overlaps with any other shows
|
|
foreach ($showInstances as $si) {
|
|
array_push($instanceIds, $si->getDbId());
|
|
|
|
$startsDateTime = $si->getDbStarts(null);
|
|
$endsDateTime = $si->getDbEnds(null);
|
|
|
|
/* The user is moving the show on the calendar from the perspective
|
|
of local time. * incase a show is moved across a time change
|
|
border offsets should be added to the local * timestamp and
|
|
then converted back to UTC to avoid show time changes */
|
|
$startsDateTime->setTimezone($displayTimezone);
|
|
$endsDateTime->setTimezone($displayTimezone);
|
|
|
|
// $newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin);
|
|
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
|
|
|
|
if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
|
return _('End date/time cannot be in the past');
|
|
}
|
|
|
|
// convert our new starts/ends to UTC.
|
|
// $newStartsDateTime->setTimezone($utc);
|
|
$newEndsDateTime->setTimezone($utcTimezone);
|
|
|
|
$overlapping = Application_Model_Schedule::checkOverlappingShows(
|
|
$startsDateTime,
|
|
$newEndsDateTime,
|
|
true,
|
|
$si->getDbId()
|
|
);
|
|
|
|
if ($overlapping) {
|
|
return _("Cannot schedule overlapping shows.\nNote: Resizing a repeating show "
|
|
. 'affects all of its repeats.');
|
|
}
|
|
}
|
|
|
|
$hours = $deltaMin / 60;
|
|
$hours = ($hours > 0) ? floor($hours) : ceil($hours);
|
|
$mins = abs($deltaMin % 60);
|
|
|
|
$sql_gen = 'UPDATE cc_show_instances '
|
|
. 'SET ends = (ends + :deltaDay1::INTERVAL + :interval1::INTERVAL) '
|
|
. 'WHERE (id IN (' . implode(',', $instanceIds) . ') '
|
|
. 'AND ends > :current_timestamp1) '
|
|
. "AND ((ends + :deltaDay2::INTERVAL + :interval2::INTERVAL - starts) <= interval '24:00')";
|
|
|
|
Application_Common_Database::prepareAndExecute(
|
|
$sql_gen,
|
|
[
|
|
':deltaDay1' => "{$deltaDay} days",
|
|
':interval1' => "{$hours}:{$mins}",
|
|
':current_timestamp1' => $nowDateTime->format(DEFAULT_TIMESTAMP_FORMAT),
|
|
':deltaDay2' => "{$deltaDay} days",
|
|
':interval2' => "{$hours}:{$mins}",
|
|
],
|
|
'execute'
|
|
);
|
|
|
|
$sql_gen = 'UPDATE cc_show_days '
|
|
. 'SET duration = (CAST(duration AS interval) + :deltaDay3::INTERVAL + :interval3::INTERVAL) '
|
|
. 'WHERE id IN (' . implode(',', $showDayIds) . ') '
|
|
. "AND ((CAST(duration AS interval) + :deltaDay4::INTERVAL + :interval4::INTERVAL) <= interval '24:00')";
|
|
|
|
Application_Common_Database::prepareAndExecute(
|
|
$sql_gen,
|
|
[
|
|
':deltaDay3' => "{$deltaDay} days",
|
|
':interval3' => "{$hours}:{$mins}",
|
|
':deltaDay4' => "{$deltaDay} days",
|
|
':interval4' => "{$hours}:{$mins}",
|
|
],
|
|
'execute'
|
|
);
|
|
|
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
|
$con->beginTransaction();
|
|
|
|
try {
|
|
// update the status flag in cc_schedule.
|
|
|
|
/* Since we didn't use a propel object when updating
|
|
* cc_show_instances table we need to clear the instances
|
|
* so the correct information is retrieved from the db
|
|
*/
|
|
CcShowInstancesPeer::clearInstancePool();
|
|
|
|
$instances = CcShowInstancesQuery::create()
|
|
->filterByDbEnds($nowDateTime->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
|
|
->filterByDbId($instanceIds, Criteria::IN)
|
|
->find($con);
|
|
|
|
foreach ($instances as $instance) {
|
|
$instance->updateScheduleStatus($con);
|
|
}
|
|
|
|
$con->commit();
|
|
} catch (Exception $e) {
|
|
$con->rollback();
|
|
Logging::info("Couldn't update schedule status.");
|
|
Logging::info($e->getMessage());
|
|
}
|
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
}
|
|
|
|
public function cancelShow($day_timestamp)
|
|
{
|
|
$timeinfo = explode(' ', $day_timestamp);
|
|
|
|
CcShowDaysQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->update(['DbLastShow' => $timeinfo[0]]);
|
|
|
|
$sql = <<<'SQL'
|
|
SELECT id from cc_show_instances
|
|
WHERE starts >= :dayTimestamp::TIMESTAMP
|
|
AND show_id = :showId
|
|
SQL;
|
|
|
|
$rows = Application_Common_Database::prepareAndExecute($sql, [
|
|
':dayTimestamp' => $day_timestamp,
|
|
':showId' => $this->getId(),
|
|
], 'all');
|
|
|
|
foreach ($rows as $row) {
|
|
try {
|
|
$showInstance = new Application_Model_ShowInstance($row['id']);
|
|
$showInstance->delete($rabbitmqPush = false);
|
|
} catch (Exception $e) {
|
|
Logging::info($e->getMessage());
|
|
}
|
|
}
|
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
}
|
|
|
|
/**
|
|
* Check whether the current show originated
|
|
* from a recording.
|
|
*
|
|
* @return bool
|
|
* true if originated from recording, otherwise false
|
|
*/
|
|
public function isRecorded()
|
|
{
|
|
$showInstancesRow = CcShowInstancesQuery::create()
|
|
->filterByDbShowId($this->getId())
|
|
->filterByDbRecord(1)
|
|
->filterByDbModifiedInstance(false)
|
|
->findOne();
|
|
|
|
return !is_null($showInstancesRow);
|
|
}
|
|
|
|
/**
|
|
* Check whether the current show has rebroadcasts of a recorded
|
|
* show. Should be used in conjunction with isRecorded().
|
|
*
|
|
* @return bool
|
|
* true if show has rebroadcasts, otherwise false
|
|
*/
|
|
public function isRebroadcast()
|
|
{
|
|
$showInstancesRow = CcShowInstancesQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->filterByDbRebroadcast(1)
|
|
->filterByDbModifiedInstance(false)
|
|
->findOne();
|
|
|
|
return !is_null($showInstancesRow);
|
|
}
|
|
|
|
/**
|
|
* Get start time and relative start date for a recorded
|
|
* shows rebroadcasts. For example start date format would be
|
|
* "x days" and time would HH:MM:SS.
|
|
*
|
|
* @return array
|
|
* array of associate arrays containing "day_offset" and "start_time"
|
|
*/
|
|
public function getRebroadcastsRelative()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT day_offset,
|
|
start_time
|
|
FROM cc_show_rebroadcast
|
|
WHERE show_id = :showId
|
|
ORDER BY day_offset
|
|
SQL;
|
|
|
|
return Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[':showId' => $this->getId()],
|
|
'all'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Check whether the current show is set to repeat
|
|
* repeating shows.
|
|
*
|
|
* @return bool
|
|
* true if repeating shows, otherwise false
|
|
*/
|
|
public function isRepeating()
|
|
{
|
|
$showDaysRow = CcShowDaysQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->findOne();
|
|
|
|
if (!is_null($showDaysRow)) {
|
|
return $showDaysRow->getDbRepeatType() != -1;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Get the repeat type of the show. Show can have repeat type of
|
|
* "weekly", "every 2 weeks", "monthly", "monthly on the same weekday",
|
|
* "every 3 weeks" and "every 4 weeks". These values are represented
|
|
* by 0, 1, 2, 3, 4 and 5, respectively.
|
|
*
|
|
* @return int
|
|
* Return the integer corresponding to the repeat type
|
|
*/
|
|
public function getRepeatType()
|
|
{
|
|
$showDaysRow = CcShowDaysQuery::create()
|
|
->filterByDbShowId($this->_showId)
|
|
->findOne();
|
|
|
|
if (!is_null($showDaysRow)) {
|
|
return $showDaysRow->getDbRepeatType();
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* Get the end date for a repeating show in the format yyyy-mm-dd.
|
|
*
|
|
* @return string
|
|
* Return the end date for the repeating show or the empty
|
|
* string if there is no end
|
|
*/
|
|
public function getRepeatingEndDate()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT last_show
|
|
FROM cc_show_days
|
|
WHERE show_id = :showId
|
|
ORDER BY last_show DESC
|
|
SQL;
|
|
|
|
$query = Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
['showId' => $this->getId()],
|
|
'column'
|
|
);
|
|
|
|
// TODO: Why return empty string instead of false? very confusing --RG
|
|
return ($query !== false) ? $query : '';
|
|
}
|
|
|
|
/**
|
|
* Deletes all future instances of the current show object
|
|
* from the show_instances table. This function is used when
|
|
* a show is being edited - in some cases, when a show is edited
|
|
* we just destroy all future show instances, and let another function
|
|
* regenerate them later on. Note that this isn't always the most
|
|
* desirable thing to do. Deleting a show instance and regenerating
|
|
* it cause any scheduled playlists within those show instances to
|
|
* be gone for good.
|
|
*/
|
|
public function deleteAllInstances()
|
|
{
|
|
$sql = <<<'SQL'
|
|
DELETE
|
|
FROM cc_show_instances
|
|
WHERE starts > :timestamp::TIMESTAMP
|
|
AND show_id = :showId
|
|
SQL;
|
|
Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[
|
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
|
':showId' => $this->getId(),
|
|
],
|
|
'execute'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Deletes all future rebroadcast instances of the current
|
|
* show object from the show_instances table.
|
|
*/
|
|
public function deleteAllRebroadcasts()
|
|
{
|
|
$sql = <<<'SQL'
|
|
DELETE
|
|
FROM cc_show_instances
|
|
WHERE starts > :timestamp::TIMESTAMP
|
|
AND show_id :showId
|
|
AND rebroadcast 1
|
|
SQL;
|
|
Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[
|
|
':showId' => $this->getId(),
|
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
|
],
|
|
'execute'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the start date of the current show in UTC timezone.
|
|
*
|
|
* @return string
|
|
* The start date in the format YYYY-MM-DD or empty string in case
|
|
* start date could not be found
|
|
*/
|
|
public function getStartDateAndTime()
|
|
{
|
|
$con = Propel::getConnection();
|
|
|
|
$showId = $this->getId();
|
|
$stmt = $con->prepare(
|
|
'SELECT first_show, start_time, timezone FROM cc_show_days'
|
|
. ' WHERE show_id = :showId'
|
|
. ' ORDER BY first_show'
|
|
. ' LIMIT 1'
|
|
);
|
|
|
|
$stmt->bindParam(':showId', $showId);
|
|
$stmt->execute();
|
|
|
|
if (!$stmt) {
|
|
return '';
|
|
}
|
|
|
|
$rows = $stmt->fetchAll();
|
|
$row = $rows[0];
|
|
|
|
$dt = new DateTime($row['first_show'] . ' ' . $row['start_time'], new DateTimeZone($row['timezone']));
|
|
$dt->setTimezone(new DateTimeZone('UTC'));
|
|
|
|
return $dt->format('Y-m-d H:i');
|
|
}
|
|
|
|
/**
|
|
* Get the start date of the current show in UTC timezone.
|
|
*
|
|
* @return string
|
|
* The start date in the format YYYY-MM-DD
|
|
*/
|
|
public function getStartDate()
|
|
{
|
|
[$date] = explode(' ', $this->getStartDateAndTime());
|
|
|
|
return $date;
|
|
}
|
|
|
|
/**
|
|
* Get the start time of the current show in UTC timezone.
|
|
*
|
|
* @return string
|
|
* The start time in the format HH:MM
|
|
*/
|
|
public function getStartTime()
|
|
{
|
|
[, $time] = explode(' ', $this->getStartDateAndTime());
|
|
|
|
return $time;
|
|
}
|
|
|
|
/**
|
|
* Get the end date of the current show.
|
|
* Note that this is not the end date of repeated show.
|
|
*
|
|
* @return string
|
|
* The end date in the format YYYY-MM-DD
|
|
*/
|
|
public function getEndDate()
|
|
{
|
|
$startDate = $this->getStartDate();
|
|
$startTime = $this->getStartTime();
|
|
$duration = $this->getDuration();
|
|
|
|
$startDateTime = new DateTime($startDate . ' ' . $startTime);
|
|
$duration = explode(':', $duration);
|
|
|
|
$endDate = $startDateTime->add(new DateInterval('PT' . $duration[0] . 'H' . $duration[1] . 'M'));
|
|
|
|
return $endDate->format('Y-m-d');
|
|
}
|
|
|
|
/**
|
|
* Get the end time of the current show.
|
|
*
|
|
* @return string
|
|
* The start time in the format HH:MM:SS
|
|
*/
|
|
public function getEndTime()
|
|
{
|
|
$startDate = $this->getStartDate();
|
|
$startTime = $this->getStartTime();
|
|
$duration = $this->getDuration();
|
|
|
|
$startDateTime = new DateTime($startDate . ' ' . $startTime);
|
|
$duration = explode(':', $duration);
|
|
|
|
$endDate = $startDateTime->add(new DateInterval('PT' . $duration[0] . 'H' . $duration[1] . 'M'));
|
|
|
|
return $endDate->format('H:i:s');
|
|
}
|
|
|
|
/**
|
|
* Indicate whether the starting point of the show is in the
|
|
* past.
|
|
*
|
|
* @return bool
|
|
* true if the StartDate is in the past, false otherwise
|
|
*/
|
|
public function isStartDateTimeInPast()
|
|
{
|
|
return gmdate(DEFAULT_TIMESTAMP_FORMAT) > ($this->getStartDate() . ' ' . $this->getStartTime());
|
|
}
|
|
|
|
/**
|
|
* Get the ID's of future instance of the current show.
|
|
*
|
|
* @return array
|
|
* A simple array containing all ID's of show instance
|
|
* scheduled in the future
|
|
*/
|
|
public function getAllFutureInstanceIds()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT id
|
|
FROM cc_show_instances
|
|
WHERE show_id = :showId
|
|
AND starts > :timestamp::TIMESTAMP
|
|
AND modified_instance != TRUE
|
|
SQL;
|
|
$rows = Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[
|
|
':showId' => $this->getId(),
|
|
':timestamp' => gmdate(DEFAULT_TIMESTAMP_FORMAT),
|
|
],
|
|
'all'
|
|
);
|
|
|
|
$res = [];
|
|
foreach ($rows as $r) {
|
|
$res[] = $r['id'];
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
|
|
/* Called when a show's duration is changed (edited).
|
|
*
|
|
* @param array $p_data
|
|
* array containing the POST data about the show from the
|
|
* browser.
|
|
*
|
|
*/
|
|
private function updateDurationTime($p_data)
|
|
{
|
|
// need to update cc_show_instances, cc_show_days
|
|
$con = Propel::getConnection();
|
|
$timestamp = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
|
|
|
$stmt = $con->prepare('UPDATE cc_show_days '
|
|
. 'SET duration = :add_show_duration '
|
|
. 'WHERE show_id = :add_show_id');
|
|
$stmt->execute([
|
|
':add_show_duration' => $p_data['add_show_duration'],
|
|
':add_show_id' => $p_data['add_show_id'],
|
|
]);
|
|
|
|
$sql = <<<'SQL'
|
|
UPDATE cc_show_instances
|
|
SET ends = starts + :add_show_duration::INTERVAL
|
|
WHERE show_id = :show_id
|
|
AND ends > :timestamp::TIMESTAMP
|
|
SQL;
|
|
|
|
Application_Common_Database::prepareAndExecute($sql, [
|
|
':add_show_duration' => $p_data['add_show_duration'],
|
|
':show_id' => $p_data['add_show_id'],
|
|
':timestamp' => $timestamp,
|
|
], 'execute');
|
|
}
|
|
|
|
public function getDuration($format = false)
|
|
{
|
|
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
|
if (!$format) {
|
|
return $showDay->getDbDuration();
|
|
}
|
|
$info = explode(':', $showDay->getDbDuration());
|
|
|
|
return str_pad(intval($info[0]), 2, '0', STR_PAD_LEFT) . 'h ' . str_pad(intval($info[1]), 2, '0', STR_PAD_LEFT) . 'm';
|
|
}
|
|
|
|
public function getShowDays()
|
|
{
|
|
$showDays = CcShowDaysQuery::create()->filterByDbShowId(
|
|
$this->getId()
|
|
)->find();
|
|
$res = [];
|
|
foreach ($showDays as $showDay) {
|
|
$res[] = $showDay->getDbDay();
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
|
|
/* Only used for shows that aren't repeating.
|
|
*
|
|
* @return Boolean: true if show has an instance, otherwise false. */
|
|
public function hasInstance()
|
|
{
|
|
return !is_null($this->getInstance());
|
|
}
|
|
|
|
/* Only used for shows that aren't repeating.
|
|
*
|
|
* @return CcShowInstancesQuery: An propel object representing a
|
|
* row in the cc_show_instances table. */
|
|
public function getInstance()
|
|
{
|
|
return CcShowInstancesQuery::create()
|
|
->filterByDbShowId($this->getId())
|
|
->findOne();
|
|
}
|
|
|
|
/**
|
|
* returns info about live stream override info.
|
|
*/
|
|
public function getLiveStreamInfo()
|
|
{
|
|
$info = [];
|
|
if ($this->getId() == null) {
|
|
return $info;
|
|
}
|
|
$ccShow = CcShowQuery::create()->findPK($this->_showId);
|
|
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
|
|
$info['cb_airtime_auth'] = $ccShow->getDbLiveStreamUsingAirtimeAuth();
|
|
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
|
|
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
|
|
$info['custom_password'] = $ccShow->getDbLiveStreamPass();
|
|
|
|
return $info;
|
|
}
|
|
|
|
/* Only used for shows that are repeating. Note that this will return
|
|
* true even for dates that only have a "modified" show instance (does not
|
|
* check if the "modified_instance" column is set to true). This is intended
|
|
* behaviour.
|
|
*
|
|
* @param $p_dateTime: Date for which we are checking if instance
|
|
* exists.
|
|
*
|
|
* @return Boolean: true if show has an instance on $p_dateTime,
|
|
* otherwise false. */
|
|
public function hasInstanceOnDate($p_dateTime)
|
|
{
|
|
return !is_null($this->getInstanceOnDate($p_dateTime));
|
|
}
|
|
|
|
/* Only used for shows that are repeating. Note that this will return
|
|
* shows that have been "modified" (does not check if the "modified_instance"
|
|
* column is set to true). This is intended behaviour.
|
|
*
|
|
* @param $p_dateTime: Date for which we are getting an instance.
|
|
*
|
|
* @return CcShowInstancesQuery: An propel object representing a
|
|
* row in the cc_show_instances table. */
|
|
public function getInstanceOnDate($p_dateTime)
|
|
{
|
|
$timestamp = $p_dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$sql = <<<'SQL'
|
|
SELECT id
|
|
FROM cc_show_instances
|
|
WHERE date(starts) = date(:timestamp::TIMESTAMP)
|
|
AND show_id = :showId
|
|
AND rebroadcast = 0;
|
|
SQL;
|
|
|
|
try {
|
|
$row = Application_Common_Database::prepareAndExecute(
|
|
$sql,
|
|
[
|
|
':showId' => $this->getId(),
|
|
':timestamp' => $timestamp,
|
|
],
|
|
'column'
|
|
);
|
|
|
|
return CcShowInstancesQuery::create()
|
|
->findPk($row);
|
|
} catch (Exception $e) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Creates show instances that are scheduled after the shows_populated_until
|
|
* value in cc_pref. If the show instances are linked their show content will
|
|
* get filled.
|
|
*
|
|
* This can occur when a user is viewing the next day/week/month in the
|
|
* calendar or when pypo is requesting the schedule after the shows_populated_until
|
|
* date and time.
|
|
*
|
|
* @param mixed $needScheduleUntil
|
|
*/
|
|
public static function createAndFillShowInstancesPastPopulatedUntilDate($needScheduleUntil)
|
|
{
|
|
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
|
|
|
|
try {
|
|
$con->beginTransaction();
|
|
// It is extremely important that we increase the transaction isolation level, so that if two
|
|
// requests cause the show schedule to be generated at the same time, one will be rolled back.
|
|
$con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
|
|
|
|
// UTC DateTime object
|
|
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
|
// if application is requesting shows past our previous populated until date, generate shows up until this point.
|
|
if (is_null($showsPopUntil) || $showsPopUntil->getTimestamp() < $needScheduleUntil->getTimestamp()) {
|
|
$service_show = new Application_Service_ShowService();
|
|
$ccShow = $service_show->delegateInstanceCreation(null, $needScheduleUntil, true);
|
|
Application_Model_Preference::SetShowsPopulatedUntil($needScheduleUntil);
|
|
}
|
|
$con->commit();
|
|
} catch (Exception $e) {
|
|
$con->rollBack();
|
|
// throw $e;
|
|
Logging::warn('Did not create show instances due to transaction error. This is usually safe
|
|
and caused by two concurrent transactions. ' . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get all the show instances in the given time range (inclusive).
|
|
*
|
|
* @param dateTime $start_timestamp
|
|
* In UTC time
|
|
* @param dateTime $end_timestamp
|
|
* In UTC time
|
|
* @param bool $onlyRecord
|
|
* @param int $showId
|
|
* limits the results to instances of a given showId only
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord = false, $showId = null)
|
|
{
|
|
self::createAndFillShowInstancesPastPopulatedUntilDate($end_timestamp);
|
|
|
|
$sql = <<<'SQL'
|
|
SELECT si1.starts AS starts,
|
|
si1.ends AS ends,
|
|
si1.record AS record,
|
|
si1.rebroadcast AS rebroadcast,
|
|
si2.starts AS parent_starts,
|
|
si1.instance_id AS record_id,
|
|
si1.show_id AS show_id,
|
|
show.name AS name,
|
|
show.description AS description,
|
|
show.color AS color,
|
|
show.background_color AS background_color,
|
|
show.image_path AS image_path,
|
|
show.linked AS linked,
|
|
si1.file_id AS file_id,
|
|
si1.id AS instance_id,
|
|
si1.description AS instance_description,
|
|
si1.created AS created,
|
|
si1.last_scheduled AS last_scheduled,
|
|
si1.time_filled AS time_filled
|
|
FROM cc_show_instances AS si1
|
|
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
|
|
LEFT JOIN cc_show AS show ON show.id = si1.show_id
|
|
WHERE si1.modified_instance = FALSE
|
|
SQL;
|
|
// only want shows that are starting at the time or later.
|
|
$start_string = $start_timestamp->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$end_string = $end_timestamp->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
|
|
$params = [];
|
|
|
|
if ($showId) {
|
|
$sql .= ' AND (si1.show_id = :show_id)';
|
|
$params[':show_id'] = $showId;
|
|
}
|
|
|
|
if ($onlyRecord) {
|
|
$sql .= ' AND (si1.starts >= :start::TIMESTAMP AND si1.starts < :end::TIMESTAMP)';
|
|
$sql .= ' AND (si1.record = 1)';
|
|
|
|
$params[':start'] = $start_string;
|
|
$params[':end'] = $end_string;
|
|
|
|
return Application_Common_Database::prepareAndExecute($sql, $params, 'all');
|
|
}
|
|
$sql .= ' ' . <<<'SQL'
|
|
AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
|
|
OR (si1.ends > :start2::TIMESTAMP AND si1.ends <= :end2::TIMESTAMP)
|
|
OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
|
|
ORDER BY si1.starts
|
|
SQL;
|
|
$params = array_merge(
|
|
$params,
|
|
[
|
|
'start1' => $start_string,
|
|
'start2' => $start_string,
|
|
'start3' => $start_string,
|
|
'end1' => $end_string,
|
|
'end2' => $end_string,
|
|
'end3' => $end_string,
|
|
]
|
|
);
|
|
|
|
return Application_Common_Database::prepareAndExecute($sql, $params, 'all');
|
|
}
|
|
|
|
private static function setNextPop($next_date, $show_id, $day)
|
|
{
|
|
$nextInfo = explode(' ', $next_date);
|
|
|
|
$repeatInfo = CcShowDaysQuery::create()
|
|
->filterByDbShowId($show_id)
|
|
->filterByDbDay($day)
|
|
->findOne();
|
|
|
|
$repeatInfo->setDbNextPopDate($nextInfo[0])
|
|
->save();
|
|
}
|
|
|
|
/**
|
|
* @param mixed $p_start
|
|
* @param mixed $p_end
|
|
* @param mixed $p_editable
|
|
*/
|
|
public static function &getFullCalendarEvents($p_start, $p_end, $p_editable = false)
|
|
{
|
|
$events = [];
|
|
$interval = $p_start->diff($p_end);
|
|
$days = $interval->format('%a');
|
|
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
|
$content_count = Application_Model_ShowInstance::getContentCount(
|
|
$p_start,
|
|
$p_end
|
|
);
|
|
$isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end);
|
|
$hasAutoPlaylist = Application_Model_ShowInstance::getShowHasAutoplaylist($p_start, $p_end);
|
|
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
|
$utcTimezone = new DateTimeZone('UTC');
|
|
$now = new DateTime('now', $utcTimezone);
|
|
|
|
foreach ($shows as &$show) {
|
|
$options = [];
|
|
|
|
$options['percent'] = Application_Model_Show::getPercentScheduled($show['starts'], $show['ends'], $show['time_filled']);
|
|
|
|
if (isset($show['parent_starts'])) {
|
|
$parentStartsDT = new DateTime($show['parent_starts'], $utcTimezone);
|
|
}
|
|
|
|
$startsDT = DateTime::createFromFormat(
|
|
'Y-m-d G:i:s',
|
|
$show['starts'],
|
|
$utcTimezone
|
|
);
|
|
$endsDT = DateTime::createFromFormat(
|
|
'Y-m-d G:i:s',
|
|
$show['ends'],
|
|
$utcTimezone
|
|
);
|
|
|
|
if ($p_editable) {
|
|
if ($show['record'] && $now > $startsDT) {
|
|
$options['editable'] = false;
|
|
} elseif (
|
|
$show['rebroadcast']
|
|
&& $now > $parentStartsDT
|
|
) {
|
|
$options['editable'] = false;
|
|
} elseif ($now < $endsDT) {
|
|
$options['editable'] = true;
|
|
}
|
|
}
|
|
|
|
$startsDT->setTimezone($displayTimezone);
|
|
$endsDT->setTimezone($displayTimezone);
|
|
|
|
$options['show_empty'] = (array_key_exists(
|
|
$show['instance_id'],
|
|
$content_count
|
|
)) ? 0 : 1;
|
|
|
|
if (array_key_exists($show['instance_id'], $isFull)) {
|
|
$options['show_partial_filled'] = !$isFull[$show['instance_id']];
|
|
} else {
|
|
$options['show_partial_filled'] = true;
|
|
}
|
|
if (array_key_exists($show['instance_id'], $hasAutoPlaylist)) {
|
|
$options['show_has_auto_playlist'] = true;
|
|
} else {
|
|
$options['show_has_auto_playlist'] = false;
|
|
}
|
|
|
|
$event = [];
|
|
|
|
$event['id'] = intval($show['instance_id']);
|
|
$event['title'] = $show['name'];
|
|
$event['start'] = $startsDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$event['end'] = $endsDT->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$event['allDay'] = false;
|
|
$event['showId'] = intval($show['show_id']);
|
|
$event['linked'] = intval($show['linked']);
|
|
$event['record'] = intval($show['record']);
|
|
$event['rebroadcast'] = intval($show['rebroadcast']);
|
|
|
|
// for putting the now playing icon on the show.
|
|
if ($now > $startsDT && $now < $endsDT) {
|
|
$event['nowPlaying'] = true;
|
|
} else {
|
|
$event['nowPlaying'] = false;
|
|
}
|
|
|
|
if (!empty($show['background_color'])) {
|
|
$event['color'] = '#' . $show['background_color'];
|
|
} else {
|
|
$event['color'] = '#' . self::getDefaultBackgroundColor($startsDT); // DEFAULT_SHOW_COLOR;
|
|
}
|
|
|
|
// event colouring
|
|
if ($show['color'] != '') {
|
|
$event['textColor'] = '#' . $show['color'];
|
|
} else {
|
|
$bg = $event['color'];
|
|
// Calculate the text colour (black or white) based on the brightness of the background.
|
|
$r = intval(substr($bg, 1, 2), 16);
|
|
$g = intval(substr($bg, 3, 2), 16);
|
|
$b = intval(substr($bg, 5, 2), 16);
|
|
$brightness = 0.299 * floatval($r) + 0.587 * floatval($g) + 0.114 * floatval($b);
|
|
if ($brightness > 130) {
|
|
$event['textColor'] = '#000000';
|
|
} else {
|
|
$event['textColor'] = '#fcfcfc';
|
|
}
|
|
}
|
|
|
|
foreach ($options as $key => $value) {
|
|
$event[$key] = $value;
|
|
}
|
|
|
|
$events[] = $event;
|
|
}
|
|
|
|
return $events;
|
|
}
|
|
|
|
/** Get a palettized colour for the show. */
|
|
private static function getDefaultBackgroundColor($date)
|
|
{
|
|
$basePalette = ['A22BE8', '2FFF8D', 'FF743C', '2ED4FF', 'E8D82B'];
|
|
// 'B23F11', 'FF7E4A', 'FF6C31'
|
|
|
|
/*
|
|
$palette = [['42d5a1', '56bd99', '65ab93', '7b938b'],
|
|
['42a4d5', '569bbd', '6594ab', '7b8b93'],
|
|
['4264d5', '566fbd', '6576ab', '7b8193']];
|
|
*/
|
|
$palette = [];
|
|
for ($baseColorIdx = 0; $baseColorIdx < count($basePalette); ++$baseColorIdx) {
|
|
$dayPalette = [];
|
|
for ($shade = 0.0; $shade < 0.8; $shade += 0.1) {
|
|
$origColour = $basePalette[$baseColorIdx];
|
|
$r = intval(substr($origColour, 0, 2), 16);
|
|
$g = intval(substr($origColour, 2, 2), 16);
|
|
$b = intval(substr($origColour, 4, 2), 16);
|
|
$r = floatval($r) * (1.0 - $shade);
|
|
$g = floatval($g) * (1.0 - $shade);
|
|
$b = floatval($b) * (1.0 - $shade);
|
|
$color = sprintf('%02x%02x%02x', $r, $g, $b);
|
|
array_push($dayPalette, $color);
|
|
}
|
|
array_push($palette, $dayPalette);
|
|
}
|
|
|
|
// $hashValue = (md5($date->format('d'))[0] % $cols) + ((intval($date->format('h'))/24) % $rows);
|
|
$row = intval($date->format('w')) % count($palette);
|
|
$foo = $date->format('H');
|
|
$col = intval(intval($date->format('H')) / 24.0 * count($palette[0]));
|
|
|
|
// $color = $palette[$hashValue % sizeof($palette)];
|
|
return $palette[$row][$col];
|
|
}
|
|
|
|
/**
|
|
* Calculates the percentage of a show scheduled given the start and end times in date/time format
|
|
* and the time_filled as the total time the schow is scheduled for in time format.
|
|
*
|
|
* TODO when using propel properly this should be a method on the propel show instance model.
|
|
*
|
|
* @param mixed $p_starts
|
|
* @param mixed $p_ends
|
|
* @param mixed $p_time_filled
|
|
*/
|
|
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled)
|
|
{
|
|
$utcTimezone = new DateTimeZone('UTC');
|
|
$startDt = new DateTime($p_starts, $utcTimezone);
|
|
$endDt = new DateTime($p_ends, $utcTimezone);
|
|
$durationSeconds = intval($endDt->format('U')) - intval($startDt->format('U'));
|
|
$time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled);
|
|
if ($durationSeconds != 0) { // Prevent division by zero if the show duration somehow becomes zero.
|
|
$percent = ceil(($time_filled / $durationSeconds) * 100);
|
|
} else {
|
|
$percent = 0;
|
|
}
|
|
|
|
return $percent;
|
|
}
|
|
|
|
/**
|
|
* Given time $timeNow, returns the show being played right now.
|
|
* Times are all in UTC time.
|
|
*
|
|
* @param string $timeNow - current time (in UTC)
|
|
*
|
|
* @return array - show being played right now
|
|
*/
|
|
public static function getCurrentShow($timeNow = null)
|
|
{
|
|
$con = Propel::getConnection();
|
|
if ($timeNow == null) {
|
|
$timeNow = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
|
}
|
|
// TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
|
$sql = <<<'SQL'
|
|
SELECT si.starts AS start_timestamp,
|
|
si.ends AS end_timestamp,
|
|
s.name,
|
|
s.description,
|
|
s.id,
|
|
si.id AS instance_id,
|
|
si.description AS instance_description,
|
|
si.record,
|
|
s.url,
|
|
s.image_path,
|
|
starts,
|
|
ends
|
|
FROM cc_show_instances si
|
|
LEFT JOIN cc_show s
|
|
ON si.show_id = s.id
|
|
WHERE si.show_id = s.id
|
|
AND si.starts <= :timeNow1::timestamp
|
|
AND si.ends > :timeNow2::timestamp
|
|
AND modified_instance != TRUE
|
|
SQL;
|
|
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(':timeNow1', $timeNow);
|
|
$stmt->bindParam(':timeNow2', $timeNow);
|
|
|
|
if ($stmt->execute()) {
|
|
$rows = $stmt->fetchAll();
|
|
} else {
|
|
$msg = implode(',', $stmt->errorInfo());
|
|
|
|
throw new Exception("Error: {$msg}");
|
|
}
|
|
|
|
return $rows;
|
|
}
|
|
|
|
/**
|
|
* Gets the current show, previous and next with an n-day window from
|
|
* the given timeNow, so timeNow-2days and timeNow+$daysToRetrieve days.
|
|
*
|
|
* @param $utcNow A DateTime object containing the current time in UTC
|
|
* @param mixed $utcEndStr
|
|
* @param mixed $showsToRetrieve
|
|
*
|
|
* @return An array containing the previous show,
|
|
* current show, and next show
|
|
*/
|
|
public static function getPrevCurrentNext($utcNow, $utcEndStr, $showsToRetrieve)
|
|
{
|
|
$timeZone = new DateTimeZone('UTC'); // This function works entirely in UTC.
|
|
assert(get_class($utcNow) === 'DateTime');
|
|
assert($utcNow->getTimeZone() == $timeZone);
|
|
|
|
$CC_CONFIG = Config::getConfig();
|
|
$con = Propel::getConnection();
|
|
|
|
// This will fetch the currently playing show first, then any
|
|
// upcoming shows within our interval, and finally move on to
|
|
// previous shows in the past 2 days.
|
|
$sql = <<<'SQL'
|
|
SELECT s.name,
|
|
s.description,
|
|
s.genre,
|
|
s.id,
|
|
si.id AS instance_id,
|
|
si.record,
|
|
s.url,
|
|
s.image_path,
|
|
starts,
|
|
ends
|
|
FROM cc_show_instances si
|
|
LEFT JOIN cc_show s
|
|
ON si.show_id = s.id
|
|
WHERE si.show_id = s.id
|
|
AND si.starts >= :timeNow::timestamp - INTERVAL '2 days'
|
|
AND si.starts < :timeEnd::timestamp
|
|
AND modified_instance != TRUE
|
|
ORDER BY
|
|
CASE
|
|
WHEN si.ends > :timeNow::timestamp
|
|
AND si.starts < :timeNow::timestamp THEN 1
|
|
WHEN si.starts > :timeNow::timestamp THEN 2
|
|
ELSE 3
|
|
END, si.starts
|
|
LIMIT :lim
|
|
SQL;
|
|
|
|
$stmt = $con->prepare($sql);
|
|
|
|
$utcNowStr = $utcNow->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$stmt->bindValue(':timeNow', $utcNowStr);
|
|
$stmt->bindValue(':timeEnd', $utcEndStr);
|
|
$stmt->bindValue(':lim', $showsToRetrieve);
|
|
|
|
if ($stmt->execute()) {
|
|
// use PDO::FETCH_ASSOC to only get the associative values
|
|
// note that fetchAll() defaults to PDO::FETCH_BOTH, which we don't want
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
} else {
|
|
$msg = implode(',', $stmt->errorInfo());
|
|
|
|
throw new Exception("Error: {$msg}");
|
|
}
|
|
|
|
$numberOfRows = count($rows);
|
|
|
|
$results['previousShow'] = [];
|
|
$results['currentShow'] = null;
|
|
$results['nextShow'] = [];
|
|
|
|
for ($i = 0; $i < $numberOfRows; ++$i) {
|
|
// all shows start/end times are stored in the database as UTC.
|
|
$showStartTime = new DateTime($rows[$i]['starts'], $timeZone);
|
|
$showEndTime = new DateTime($rows[$i]['ends'], $timeZone);
|
|
|
|
// Find the show that is within the current time.
|
|
if (($showStartTime <= $utcNow) && ($showEndTime > $utcNow)) {
|
|
$results['currentShow'] = $rows[$i];
|
|
} elseif ($showEndTime < $utcNow) {
|
|
array_push($results['previousShow'], $rows[$i]);
|
|
} elseif ($showStartTime > $utcNow) {
|
|
array_push($results['nextShow'], $rows[$i]);
|
|
}
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
/**
|
|
* Gets the current show, previous and next with an 2day window from
|
|
* the given timeNow, so timeNow-2days and timeNow+2days.
|
|
*
|
|
* @param $utcNow A DateTime object containing the current time in UTC
|
|
*
|
|
* @return An array (with stupid sub-arrays) containing the previous show id,
|
|
* current show id, and next show id
|
|
*
|
|
* @deprecated
|
|
*/
|
|
public static function getPrevCurrentNextOld($utcNow)
|
|
{
|
|
$timeZone = new DateTimeZone('UTC'); // This function works entirely in UTC.
|
|
assert(get_class($utcNow) === 'DateTime');
|
|
assert($utcNow->getTimeZone() == $timeZone);
|
|
|
|
$CC_CONFIG = Config::getConfig();
|
|
$con = Propel::getConnection();
|
|
|
|
// TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
|
$sql = <<<'SQL'
|
|
SELECT si.starts AS start_timestamp,
|
|
si.ends AS end_timestamp,
|
|
s.name,
|
|
s.description,
|
|
s.id,
|
|
si.id AS instance_id,
|
|
si.record,
|
|
s.url,
|
|
s.image_path,
|
|
starts,
|
|
ends
|
|
FROM cc_show_instances si
|
|
LEFT JOIN cc_show s
|
|
ON si.show_id = s.id
|
|
WHERE si.show_id = s.id
|
|
AND si.starts > :timeNow1::timestamp - INTERVAL '2 days'
|
|
AND si.ends < :timeNow2::timestamp + INTERVAL '2 days'
|
|
AND modified_instance != TRUE
|
|
ORDER BY si.starts
|
|
SQL;
|
|
|
|
$stmt = $con->prepare($sql);
|
|
|
|
$utcNowStr = $utcNow->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
$stmt->bindValue(':timeNow1', $utcNowStr);
|
|
$stmt->bindValue(':timeNow2', $utcNowStr);
|
|
|
|
if ($stmt->execute()) {
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
} else {
|
|
$msg = implode(',', $stmt->errorInfo());
|
|
|
|
throw new Exception("Error: {$msg}");
|
|
}
|
|
|
|
$numberOfRows = count($rows);
|
|
|
|
$results['previousShow'] = [];
|
|
$results['currentShow'] = [];
|
|
$results['nextShow'] = [];
|
|
|
|
for ($i = 0; $i < $numberOfRows; ++$i) {
|
|
// All shows start/end times are stored in the database as UTC.
|
|
$showStartTime = new DateTime($rows[$i]['starts'], $timeZone);
|
|
$showEndTime = new DateTime($rows[$i]['ends'], $timeZone);
|
|
|
|
// Find the show that is within the current time.
|
|
if (($showStartTime <= $utcNow) && ($showEndTime > $utcNow)) {
|
|
if ($i - 1 >= 0) {
|
|
$results['previousShow'][0] = [
|
|
'id' => $rows[$i - 1]['id'],
|
|
'instance_id' => $rows[$i - 1]['instance_id'],
|
|
'name' => $rows[$i - 1]['name'],
|
|
'description' => $rows[$i - 1]['description'],
|
|
'url' => $rows[$i - 1]['url'],
|
|
'start_timestamp' => $rows[$i - 1]['start_timestamp'],
|
|
'end_timestamp' => $rows[$i - 1]['end_timestamp'],
|
|
'starts' => $rows[$i - 1]['starts'],
|
|
'ends' => $rows[$i - 1]['ends'],
|
|
'record' => $rows[$i - 1]['record'],
|
|
'image_path' => $rows[$i - 1]['image_path'],
|
|
'type' => 'show',
|
|
];
|
|
}
|
|
|
|
$results['currentShow'][0] = $rows[$i];
|
|
|
|
if (isset($rows[$i + 1])) {
|
|
$results['nextShow'][0] = [
|
|
'id' => $rows[$i + 1]['id'],
|
|
'instance_id' => $rows[$i + 1]['instance_id'],
|
|
'name' => $rows[$i + 1]['name'],
|
|
'description' => $rows[$i + 1]['description'],
|
|
'url' => $rows[$i + 1]['url'],
|
|
'start_timestamp' => $rows[$i + 1]['start_timestamp'],
|
|
'end_timestamp' => $rows[$i + 1]['end_timestamp'],
|
|
'starts' => $rows[$i + 1]['starts'],
|
|
'ends' => $rows[$i + 1]['ends'],
|
|
'record' => $rows[$i + 1]['record'],
|
|
'image_path' => $rows[$i + 1]['image_path'],
|
|
'type' => 'show',
|
|
];
|
|
}
|
|
|
|
break;
|
|
}
|
|
// Previous is any row that ends after time now capture it in case we need it later.
|
|
if ($showEndTime < $utcNow) {
|
|
$previousShowIndex = $i;
|
|
}
|
|
// if we hit this we know we've gone to far and can stop looping.
|
|
if ($showStartTime > $utcNow) {
|
|
$results['nextShow'][0] = [
|
|
'id' => $rows[$i]['id'],
|
|
'instance_id' => $rows[$i]['instance_id'],
|
|
'name' => $rows[$i]['name'],
|
|
'description' => $rows[$i]['description'],
|
|
'url' => $rows[$i]['url'],
|
|
'start_timestamp' => $rows[$i]['start_timestamp'],
|
|
'end_timestamp' => $rows[$i]['end_timestamp'],
|
|
'starts' => $rows[$i]['starts'],
|
|
'ends' => $rows[$i]['ends'],
|
|
'record' => $rows[$i]['record'],
|
|
'image_path' => $rows[$i]['image_path'],
|
|
'type' => 'show',
|
|
];
|
|
|
|
break;
|
|
}
|
|
}
|
|
// If we didn't find a a current show because the time didn't fit we may still have
|
|
// found a previous show so use it.
|
|
if (count($results['previousShow']) == 0 && isset($previousShowIndex)) {
|
|
$results['previousShow'][0] = [
|
|
'id' => $rows[$previousShowIndex]['id'],
|
|
'instance_id' => $rows[$previousShowIndex]['instance_id'],
|
|
'name' => $rows[$previousShowIndex]['name'],
|
|
'description' => $rows[$previousShowIndex]['description'],
|
|
'start_timestamp' => $rows[$previousShowIndex]['start_timestamp'],
|
|
'end_timestamp' => $rows[$previousShowIndex]['end_timestamp'],
|
|
'starts' => $rows[$previousShowIndex]['starts'],
|
|
'ends' => $rows[$previousShowIndex]['ends'],
|
|
'record' => $rows[$previousShowIndex]['record'],
|
|
'type' => 'show',
|
|
];
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
/**
|
|
* Given a start time $timeStart and end time $timeEnd, returns the next $limit
|
|
* number of shows within the time interval
|
|
* If $timeEnd not given, shows within next 48 hours from $timeStart are returned
|
|
* If $limit not given, all shows within the intervals are returned
|
|
* Times are all in UTC time.
|
|
*
|
|
* @param string $timeStart - interval start time (in UTC)
|
|
* @param int $limit - number of shows to return
|
|
* @param string $timeEnd - interval end time (in UTC)
|
|
*
|
|
* @return array - the next $limit number of shows within the time interval
|
|
*/
|
|
public static function getNextShows($timeStart, $limit = 'ALL', $timeEnd = '')
|
|
{
|
|
// defaults to retrieving shows from next 2 days if no end time has
|
|
// been specified
|
|
if ($timeEnd == '') {
|
|
$timeEnd = "'{$timeStart}' + INTERVAL '2 days'";
|
|
}
|
|
|
|
// TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
|
$sql = <<<'SQL'
|
|
SELECT si.starts AS start_timestamp,
|
|
si.ends AS end_timestamp,
|
|
s.name,
|
|
s.description,
|
|
s.id,
|
|
si.id AS instance_id,
|
|
si.description AS instance_description,
|
|
si.record,
|
|
s.url,
|
|
s.image_path,
|
|
starts,
|
|
ends
|
|
FROM cc_show_instances si
|
|
LEFT JOIN cc_show s
|
|
ON si.show_id = s.id
|
|
WHERE si.show_id = s.id
|
|
AND si.starts >= :timeStart::timestamp
|
|
AND si.starts < :timeEnd::timestamp
|
|
AND modified_instance != TRUE
|
|
ORDER BY si.starts
|
|
SQL;
|
|
|
|
// PDO won't accept "ALL" as a limit value (complains it is not an
|
|
// integer, and so we must completely remove the limit clause if we
|
|
// want to show all results - MK
|
|
if ($limit != 'ALL') {
|
|
$sql .= PHP_EOL . 'LIMIT :lim';
|
|
$params = [
|
|
':timeStart' => $timeStart,
|
|
':timeEnd' => $timeEnd,
|
|
':lim' => $limit,
|
|
];
|
|
} else {
|
|
$params = [
|
|
':timeStart' => $timeStart,
|
|
':timeEnd' => $timeEnd,
|
|
];
|
|
}
|
|
|
|
return Application_Common_Database::prepareAndExecute($sql, $params, 'all');
|
|
}
|
|
|
|
public static function getMaxLengths()
|
|
{
|
|
$sql = <<<'SQL'
|
|
SELECT column_name, character_maximum_length FROM information_schema.columns
|
|
WHERE table_name = 'cc_show' AND character_maximum_length > 0
|
|
SQL;
|
|
$result = Application_Common_Database::prepareAndExecute($sql);
|
|
$assocArray = [];
|
|
foreach ($result as $row) {
|
|
$assocArray[$row['column_name']] = $row['character_maximum_length'];
|
|
}
|
|
|
|
return $assocArray;
|
|
}
|
|
|
|
public static function getStartEndCurrentMonthView()
|
|
{
|
|
$utcTimeZone = new DateTimeZone('UTC');
|
|
|
|
// We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
|
$start = new DateTime('first day of this month', new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
|
|
|
$start->setTimezone($utcTimeZone); // Covert it to UTC.
|
|
$monthInterval = new DateInterval('P1M');
|
|
$end = clone $start;
|
|
$end->add($monthInterval);
|
|
|
|
return [$start, $end];
|
|
}
|
|
|
|
/** Returns the start and end date that FullCalendar will display for today's month.
|
|
*
|
|
* FullCalendar displays 6 weeks, starting on a Sunday, for a total of 42 days. This function returns 42 days worth
|
|
* of data (a few days before, and a few days after.)
|
|
*/
|
|
public static function getStartEndCurrentMonthPlusView()
|
|
{
|
|
$utcTimeZone = new DateTimeZone('UTC');
|
|
|
|
// We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
|
$start = new DateTime('first day of this month', new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
|
|
|
$dayOfWeekNumeric = $start->format('w');
|
|
$start->sub(new DateInterval("P{$dayOfWeekNumeric}D")); // Subtract the index of the day of the week the month starts on. (adds this many days from the previous month)
|
|
$start->setTimezone($utcTimeZone); // Covert it to UTC.
|
|
|
|
$fullCalendarMonthInterval = new DateInterval('P42D'); // 42 days
|
|
$end = clone $start;
|
|
$end->add($fullCalendarMonthInterval);
|
|
|
|
return [$start, $end];
|
|
}
|
|
|
|
public static function getStartEndCurrentWeekView()
|
|
{
|
|
$weekStartDayNum = Application_Model_Preference::GetWeekStartDay();
|
|
$utcTimeZone = new DateTimeZone('UTC');
|
|
|
|
// We have to get the start of the week in the user's timezone, and then convert that to UTC.
|
|
$start = new DateTime('Sunday last week', new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
|
$start->add(new DateInterval("P{$weekStartDayNum}D")); // Shift the start date to the station's "Week Starts on Day"
|
|
|
|
$start->setTimezone($utcTimeZone); // Covert it to UTC.
|
|
$weekInterval = new DateInterval('P1W');
|
|
$end = clone $start;
|
|
$end->add($weekInterval);
|
|
|
|
return [$start, $end];
|
|
}
|
|
|
|
public static function getStartEndCurrentDayView()
|
|
{
|
|
$utcTimeZone = new DateTimeZone('UTC');
|
|
|
|
// We have to get the start of the day in the user's timezone, and then convert that to UTC.
|
|
$start = new DateTime('today', new DateTimeZone(Application_Model_Preference::GetUserTimezone()));
|
|
|
|
$start->setTimezone($utcTimeZone); // Covert it to UTC.
|
|
$dayInterval = new DateInterval('P1D');
|
|
$end = clone $start;
|
|
$end->add($dayInterval);
|
|
|
|
return [$start, $end];
|
|
}
|
|
}
|