diff --git a/build/runtime.php b/build/runtime.php index e78f4cc05..89cf063d2 100644 --- a/build/runtime.php +++ b/build/runtime.php @@ -22,6 +22,8 @@ exit(1); } +$_ENV['FLOW_PHAR_APP'] = 1; + \ini_set('memory_limit', -1); (new SingleCommandApplication()) diff --git a/examples/bootstrap.php b/examples/bootstrap.php index 6077883ff..fcd170acf 100644 --- a/examples/bootstrap.php +++ b/examples/bootstrap.php @@ -1,6 +1,6 @@ withEntry('consumption', concat(ref('consumption'), lit('%'))) ->write(To::output(truncate: false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/aggregations/power_plant_bar_chart.php b/examples/topics/aggregations/power_plant_bar_chart.php index 08e0f52ed..f4873d12d 100644 --- a/examples/topics/aggregations/power_plant_bar_chart.php +++ b/examples/topics/aggregations/power_plant_bar_chart.php @@ -51,7 +51,7 @@ ) ); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/async/bootstrap.php b/examples/topics/async/bootstrap.php index cc85669e8..fd01219cf 100644 --- a/examples/topics/async/bootstrap.php +++ b/examples/topics/async/bootstrap.php @@ -1,7 +1,7 @@ select('name', 'html_url', 'blog') ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/join/left_anti/left_anti_join.php b/examples/topics/join/left_anti/left_anti_join.php index 85454db70..b7986c10d 100644 --- a/examples/topics/join/left_anti/left_anti_join.php +++ b/examples/topics/join/left_anti/left_anti_join.php @@ -39,7 +39,7 @@ ) ->write(To::output()); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/join/left_anti/left_anti_join_each.php b/examples/topics/join/left_anti/left_anti_join_each.php index 3425aeba0..8d94c0153 100644 --- a/examples/topics/join/left_anti/left_anti_join_each.php +++ b/examples/topics/join/left_anti/left_anti_join_each.php @@ -78,7 +78,7 @@ private function findRowsInDatabase(Rows $rows) : Rows ) ->write(To::output()); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/aggregate.php b/examples/topics/transformations/aggregate.php index dea2b4b10..5595f6887 100644 --- a/examples/topics/transformations/aggregate.php +++ b/examples/topics/transformations/aggregate.php @@ -26,7 +26,7 @@ ->aggregate(Aggregation::sum(ref('a'))) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/array_expand.php b/examples/topics/transformations/array_expand.php index c3bf69e19..c9f2310f4 100644 --- a/examples/topics/transformations/array_expand.php +++ b/examples/topics/transformations/array_expand.php @@ -23,7 +23,7 @@ ->withEntry('expanded', array_expand(ref('array'))) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/array_unpack.php b/examples/topics/transformations/array_unpack.php index b753f08ce..a9fcffc41 100644 --- a/examples/topics/transformations/array_unpack.php +++ b/examples/topics/transformations/array_unpack.php @@ -23,7 +23,7 @@ ->withEntry('unpacked', ref('array')->unpack()) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/filter_divide.php b/examples/topics/transformations/filter_divide.php index 32f002e61..96efb7b97 100644 --- a/examples/topics/transformations/filter_divide.php +++ b/examples/topics/transformations/filter_divide.php @@ -24,7 +24,7 @@ ->withEntry('new_b', ref('b')->multiply(lit(2))->multiply(lit(5))) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/filter_mod.php b/examples/topics/transformations/filter_mod.php index 86e4d2d7b..fc146121a 100644 --- a/examples/topics/transformations/filter_mod.php +++ b/examples/topics/transformations/filter_mod.php @@ -23,7 +23,7 @@ ->filter(ref('b')->mod(lit(2))->equals(lit(0))) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/group_by.php b/examples/topics/transformations/group_by.php index f5b768787..44f56f6dd 100644 --- a/examples/topics/transformations/group_by.php +++ b/examples/topics/transformations/group_by.php @@ -25,7 +25,7 @@ ->groupBy(ref('a')) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/literals.php b/examples/topics/transformations/literals.php index abe2b5b50..ea1c93b3a 100644 --- a/examples/topics/transformations/literals.php +++ b/examples/topics/transformations/literals.php @@ -21,7 +21,7 @@ ->withEntry('number', lit(1)) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/math.php b/examples/topics/transformations/math.php index 7699c81ac..7f74354e8 100644 --- a/examples/topics/transformations/math.php +++ b/examples/topics/transformations/math.php @@ -23,7 +23,7 @@ ->withEntry('d', ref('b')->minus(ref('a'))) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/size.php b/examples/topics/transformations/size.php index ff8155851..e3d3ab59d 100644 --- a/examples/topics/transformations/size.php +++ b/examples/topics/transformations/size.php @@ -21,7 +21,7 @@ ->withEntry('array_size', ref('array')->size()) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/sort.php b/examples/topics/transformations/sort.php index 867b9631e..129f75b48 100644 --- a/examples/topics/transformations/sort.php +++ b/examples/topics/transformations/sort.php @@ -14,7 +14,7 @@ ->sortBy(ref('id')->desc()) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/when_null.php b/examples/topics/transformations/when_null.php index 4d53d79d0..23a181d19 100644 --- a/examples/topics/transformations/when_null.php +++ b/examples/topics/transformations/when_null.php @@ -28,7 +28,7 @@ ) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/transformations/when_odd.php b/examples/topics/transformations/when_odd.php index 9b5b3a88d..db6078865 100644 --- a/examples/topics/transformations/when_odd.php +++ b/examples/topics/transformations/when_odd.php @@ -24,7 +24,7 @@ ) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_read.php b/examples/topics/types/csv/csv_read.php index 8124758bc..d0f321478 100644 --- a/examples/topics/types/csv/csv_read.php +++ b/examples/topics/types/csv/csv_read.php @@ -17,7 +17,7 @@ ->drop(col('row')) ->limit(10_000); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_read_partitioned.php b/examples/topics/types/csv/csv_read_partitioned.php index a51a4e006..8696ebf10 100644 --- a/examples/topics/types/csv/csv_read_partitioned.php +++ b/examples/topics/types/csv/csv_read_partitioned.php @@ -20,7 +20,7 @@ ->sortBy(ref('id')) ->write(To::output()); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_read_partitioned_filter.php b/examples/topics/types/csv/csv_read_partitioned_filter.php index 1242919d8..52707d932 100644 --- a/examples/topics/types/csv/csv_read_partitioned_filter.php +++ b/examples/topics/types/csv/csv_read_partitioned_filter.php @@ -21,7 +21,7 @@ ->sortBy(ref('id')) ->write(To::output()); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_to_avro.php b/examples/topics/types/csv/csv_to_avro.php index 8cc46dfdd..0da65948f 100644 --- a/examples/topics/types/csv/csv_to_avro.php +++ b/examples/topics/types/csv/csv_to_avro.php @@ -19,7 +19,7 @@ ->rename('last name', 'last_name') ->write(Avro::to(__FLOW_OUTPUT__ . '/dataset.avro')); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_to_json.php b/examples/topics/types/csv/csv_to_json.php index 3c0da7669..0ce1d071a 100644 --- a/examples/topics/types/csv/csv_to_json.php +++ b/examples/topics/types/csv/csv_to_json.php @@ -19,7 +19,7 @@ ->drop(col('row')) ->write(Json::to(__FLOW_OUTPUT__ . '/dataset.json')); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_to_parquet_100k.php b/examples/topics/types/csv/csv_to_parquet_100k.php index 716728e31..18e1e95b2 100644 --- a/examples/topics/types/csv/csv_to_parquet_100k.php +++ b/examples/topics/types/csv/csv_to_parquet_100k.php @@ -18,7 +18,7 @@ ->drop(col('row')) ->write(Parquet::to(__FLOW_OUTPUT__ . '/dataset_100k.parquet', 100_000)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/csv_to_parquet_10k.php b/examples/topics/types/csv/csv_to_parquet_10k.php index ae0b69032..5f56ee45d 100644 --- a/examples/topics/types/csv/csv_to_parquet_10k.php +++ b/examples/topics/types/csv/csv_to_parquet_10k.php @@ -18,7 +18,7 @@ ->drop(col('row')) ->write(Parquet::to(__FLOW_OUTPUT__ . '/dataset_10k.parquet', 10_000)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/php_to_csv.php b/examples/topics/types/csv/php_to_csv.php index 0f8a52d79..67d9d8def 100644 --- a/examples/topics/types/csv/php_to_csv.php +++ b/examples/topics/types/csv/php_to_csv.php @@ -20,7 +20,7 @@ ->drop(col('row')) ->write(CSV::to(__FLOW_OUTPUT__ . '/dataset.csv')); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/php_to_csv_and_json.php b/examples/topics/types/csv/php_to_csv_and_json.php index 9617aa63a..be6f04e79 100644 --- a/examples/topics/types/csv/php_to_csv_and_json.php +++ b/examples/topics/types/csv/php_to_csv_and_json.php @@ -22,7 +22,7 @@ ->write(CSV::to(__FLOW_OUTPUT__ . '/dataset.csv')) ->write(Json::to(__FLOW_OUTPUT__ . '/dataset.json')); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/csv/php_to_csv_partition.php b/examples/topics/types/csv/php_to_csv_partition.php index e44938302..b09064182 100644 --- a/examples/topics/types/csv/php_to_csv_partition.php +++ b/examples/topics/types/csv/php_to_csv_partition.php @@ -22,7 +22,7 @@ ->partitionBy('country_code', 't_shirt_color') ->write(CSV::to(__FLOW_OUTPUT__ . '/partitioned')); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/xml/reading.php b/examples/topics/types/xml/reading.php index 4a9a5b6a6..d59239149 100644 --- a/examples/topics/types/xml/reading.php +++ b/examples/topics/types/xml/reading.php @@ -12,7 +12,7 @@ ->read(XML::from(__FLOW_DATA__ . '/simple_items.xml', 'root/items/item')) ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; } diff --git a/examples/topics/types/xml/salaries.php b/examples/topics/types/xml/salaries.php index 242f136a4..36d7ed41c 100644 --- a/examples/topics/types/xml/salaries.php +++ b/examples/topics/types/xml/salaries.php @@ -25,7 +25,7 @@ ->rename('department_salary_sum', 'total_monthly_salaries') ->write(To::output(false)); -if ('' !== \Phar::running(false)) { +if ($_ENV['FLOW_PHAR_APP'] ?? false) { return $flow; }