88use Stolt \LeanPackage \Exceptions \InvalidGlobPatternFile ;
99use Stolt \LeanPackage \Exceptions \NonExistentGlobPatternFile ;
1010use Stolt \LeanPackage \Exceptions \PresetNotAvailable ;
11- use Stolt \LeanPackage \Gitattributes \ValueObject as GitattributesValueObject ;
1211use Stolt \LeanPackage \Gitattributes \FileRepository as GitattributesFileRepository ;
12+ use Stolt \LeanPackage \Gitattributes \ValueObject as GitattributesValueObject ;
1313use Stolt \LeanPackage \Glob ;
1414use Stolt \LeanPackage \Helpers \Str ;
1515use Stolt \LeanPackage \Presets \Finder ;
@@ -158,20 +158,20 @@ public function __construct(
158158 protected readonly Finder $ finder ,
159159 protected readonly GitattributesFileRepository $ gitattributesFileRepository ,
160160 string $ directory = '' ,
161- ?ExportIgnoreConfiguration $ configuration = null )
162- {
161+ ?ExportIgnoreConfiguration $ configuration = null
162+ ) {
163163 $ this ->defaultGlobPattern = $ finder ->getDefaultPreset ();
164164
165165 $ configuration ??= new ExportIgnoreConfiguration (
166166 directory: $ directory ,
167- globPattern: '{ ' . implode (', ' , $ this ->defaultGlobPattern ) . '}* ' ,
167+ globPattern: '{ ' . \ implode (', ' , $ this ->defaultGlobPattern ) . '}* ' ,
168168 );
169169
170170 $ this ->configuration = $ configuration ;
171171
172172 $ this ->directory = $ configuration ->directory ;
173173
174- if (!is_dir ($ this ->directory ) && defined ('WORKING_DIRECTORY ' )) {
174+ if (!\ is_dir ($ this ->directory ) && \ defined ('WORKING_DIRECTORY ' )) {
175175 $ this ->directory = WORKING_DIRECTORY ;
176176 }
177177
@@ -206,9 +206,9 @@ public function getDirectory(): string
206206 * Set the directory to analyse.
207207 *
208208 * @param string $directory The directory to analyse.
209- * @return AbstractExportIgnoreAnalyser
210209 *
211210 * @throws RuntimeException
211+ * @return AbstractExportIgnoreAnalyser
212212 */
213213 public function setDirectory (string $ directory = __DIR__ ): AbstractExportIgnoreAnalyser
214214 {
@@ -358,8 +358,8 @@ public function isKeepReadmeEnabled(): bool
358358 * Sets the glob pattern for not export-ignoring license files.
359359 *
360360 * @param string $globPattern
361- * @return AbstractExportIgnoreAnalyser
362361 * @throws InvalidGlobPattern
362+ * @return AbstractExportIgnoreAnalyser
363363 */
364364 public function setKeepGlobPattern (string $ globPattern ): AbstractExportIgnoreAnalyser
365365 {
@@ -538,9 +538,9 @@ public function getGitattributesFileRepository(): GitattributesFileRepository
538538 * Set the glob pattern file.
539539 *
540540 * @param string $file
541- * @return AbstractExportIgnoreAnalyser
542541 * @throws InvalidGlobPatternFile
543542 * @throws NonExistentGlobPatternFile
543+ * @return AbstractExportIgnoreAnalyser
544544 */
545545 public function setGlobPatternFromFile (string $ file ): AbstractExportIgnoreAnalyser
546546 {
@@ -580,9 +580,9 @@ public function setGlobPatternFromFile(string $file): AbstractExportIgnoreAnalys
580580 *
581581 * @param string $pattern The glob pattern to use to detect expected export-ignores files.
582582 *
583- * @return AbstractExportIgnoreAnalyser
584583 *
585584 * @throws InvalidGlobPattern
585+ * @return AbstractExportIgnoreAnalyser
586586 */
587587 public function setGlobPattern (string $ pattern ): AbstractExportIgnoreAnalyser
588588 {
@@ -604,7 +604,7 @@ protected function guardGlobPattern(string $pattern): void
604604 $ invalidGlobPattern = false ;
605605
606606 if (\substr ($ pattern , 0 ) !== '{ '
607- && (!str_ends_with ($ pattern , '} ' ) && !str_ends_with ($ pattern , '}* ' ))) {
607+ && (!\ str_ends_with ($ pattern , '} ' ) && !\ str_ends_with ($ pattern , '}* ' ))) {
608608 $ invalidGlobPattern = true ;
609609 }
610610
@@ -645,11 +645,11 @@ protected function getGitignorePatterns(string $gitignoreFile): array
645645
646646 \array_filter ($ gitignoreLines , static function ($ line ) use (&$ gitignoredPatterns ) {
647647 $ line = \trim ($ line );
648- if ($ line !== '' && !str_contains ($ line , '# ' )) {
649- if (str_starts_with ($ line , "/ " )) {
648+ if ($ line !== '' && !\ str_contains ($ line , '# ' )) {
649+ if (\ str_starts_with ($ line , "/ " )) {
650650 $ gitignoredPatterns [] = \substr ($ line , 1 );
651651 }
652- if (str_ends_with ($ line , "/ " )) {
652+ if (\ str_ends_with ($ line , "/ " )) {
653653 $ gitignoredPatterns [] = \substr ($ line , 0 , -1 );
654654 }
655655 $ gitignoredPatterns [] = $ line ;
@@ -679,9 +679,9 @@ public function getGitignoredPatterns(): array
679679 */
680680 protected function patternHasMatch (string $ globPattern ): bool
681681 {
682- if (str_starts_with (\trim ($ globPattern ), '/ ' )) {
682+ if (\ str_starts_with (\trim ($ globPattern ), '/ ' )) {
683683 $ globPattern = \trim (\substr ($ globPattern , 1 ));
684- } elseif (str_ends_with (\trim ($ globPattern ), '/ ' )) {
684+ } elseif (\ str_ends_with (\trim ($ globPattern ), '/ ' )) {
685685 $ globPattern = \trim (\substr ($ globPattern , 0 , -1 ));
686686 } else {
687687 $ globPattern = '{ ' . \trim ($ globPattern ) . '}* ' ;
@@ -800,7 +800,7 @@ public function getPresentNonExportIgnoresContent(): string
800800 \array_filter ($ gitattributesLines , static function (string $ line ) use (
801801 &$ nonExportIgnoreLines
802802 ) {
803- if (!str_contains ($ line , 'export-ignore ' ) || \strstr ($ line , '# ' )) {
803+ if (!\ str_contains ($ line , 'export-ignore ' ) || \strstr ($ line , '# ' )) {
804804 $ nonExportIgnoreLines [] = \trim ($ line );
805805 }
806806 });
@@ -823,7 +823,7 @@ public function getPresentNonExportIgnoresContent(): string
823823 &$ exportIgnoresPlacementPlaceholderSet ,
824824 &$ exportIgnoresPlacementPlaceholder
825825 ) {
826- if (!str_contains ($ line , 'export-ignore ' ) || \strstr ($ line , '# ' )) {
826+ if (!\ str_contains ($ line , 'export-ignore ' ) || \strstr ($ line , '# ' )) {
827827 return $ nonExportIgnoreLines [] = \trim ($ line );
828828 } else {
829829 if ($ exportIgnoresPlacementPlaceholderSet === false ) {
@@ -854,8 +854,8 @@ protected function getAlignedExportIgnoreArtifacts(array $artifacts): array
854854 return \array_map (static function (string $ artifact ) use (&$ longestArtifact ) {
855855 if (\strlen ($ artifact ) < $ longestArtifact ) {
856856 return $ artifact . \str_repeat (
857- ' ' ,
858- $ longestArtifact - \strlen ($ artifact )
857+ ' ' ,
858+ $ longestArtifact - \strlen ($ artifact )
859859 );
860860 }
861861 return $ artifact ;
@@ -871,7 +871,7 @@ protected function getByDirectoriesToFilesExportIgnoreArtifacts(array $artifacts
871871 });
872872
873873 $ files = \array_filter ($ artifacts , static function (string $ artifact ) {
874- if (!str_contains ($ artifact , '/ ' )) {
874+ if (!\ str_contains ($ artifact , '/ ' )) {
875875 return $ artifact ;
876876 }
877877 });
0 commit comments