xref: /imagick/util/type_check.php (revision df4a6a7f)
1<?php
2
3$rc = new ReflectionClass(Imagick::class);
4
5$constants = $rc->getConstants();
6
7$found_prefixes = [];
8
9foreach ($constants as $key => $value) {
10    $first_underscore_position = strpos($key, '_');
11    if ($first_underscore_position === false) {
12        echo "constant found without underscore: $key\n";
13        continue;
14    }
15
16    $prefix = substr($key, 0, $first_underscore_position);
17    if (in_array($prefix, $found_prefixes, true) === false) {
18        $found_prefixes[] = $prefix;
19    }
20}
21
22sort($found_prefixes);
23
24echo "Prefixes are:\n";
25foreach ($found_prefixes as $prefix) {
26    echo "$prefix\n";
27}
28
29$map_of_constants_to_enums = [
30
31	'ALIGN' => "AlignType",
32	'ALPHACHANNEL' => "AlphaChannelOption",
33	'CHANNEL' => "ChannelType",
34	'COLOR' => null, // for some reason we don't use the ImageMagick constants...
35	'COLORSPACE' => "ColorspaceType",
36	'COMPOSITE' => "CompositeOperator",
37	'COMPRESSION' => "CompressionType",
38	'DECORATION' => "DecorationType",
39	'DIRECTION' => "DirectionType",
40	'DISPOSE' => "DisposeType",
41	'DISTORTION' => "DistortMethod",
42	'DITHERMETHOD' => "DitherMethod",
43	'EVALUATE' => "MagickEvaluateOperator", //
44	'FILLRULE' => "FillRule",
45	'FILTER' => "FilterType",
46	'FUNCTION' => "MagickFunction", //
47	'GRAVITY' => "GravityType",
48	'IMAGICK' => null,// this is internal to extension e.g. PHP_IMAGICK_EXTNUM
49	'IMGTYPE' => "ImageType",
50	'INTERLACE' => "InterlaceType",
51	'INTERPOLATE' => "PixelInterpolateMethod",   //
52	'KERNEL' => "KernelInfoType",
53	'LAYERMETHOD' => "LayerMethod",
54	'LINECAP' => "LineCap",
55	'LINEJOIN' => "LineJoin",
56	'METRIC' => "MetricType",
57	'MONTAGEMODE' => "MontageMode",
58	'MORPHOLOGY' => "MorphologyMethod",
59	'NOISE' => "NoiseType",
60	// 'NORMALIZE_KERNEL' => "GeometryFlags"  - this is not a trivial list of enums...
61	'ORIENTATION' => "OrientationType",
62	'PAINT' => "PaintMethod",
63	'PATHUNITS' => "ClipPathUnits",
64	'PIXELMASK' => "PixelMask",
65	//	'PIXEL' => 'StorageType', // todo - deprecate this constant.
66	'PIXELSTORAGE' => 'StorageType',
67	'PREVIEW' => "PreviewType",
68	'QUANTUM' => null, // internal to extension e.g.  atoi (MagickQuantumRange)
69	'RENDERINGINTENT' => "RenderingIntent",
70	'RESOLUTION' => "ResolutionType",
71	'RESOURCETYPE' => "ResourceType",
72	'SPARSECOLORMETHOD' => "SparseColorMethod",
73	'STATISTIC' => "StatisticType",
74	'STRETCH' => "StretchType",
75	'STYLE' => "StyleType",
76	'USE' => null, // internal to extension USE_ZEND_MM
77	'VIRTUALPIXELMETHOD' => "VirtualPixelMethod",
78];